Functions

Functions

template<typename Type >
BLAZE_ALWAYS_INLINE void blaze::clear (Type &clearable)
 Clearing the given value/object to the default state. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_< IsBuiltin< T >, T > blaze::conj (T a) noexcept
 Computing the conjugate of the given value/object. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE void blaze::conjugate (T &a) noexcept(IsNumeric< T >::value)
 In-place conjugation of the given value/object. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE void blaze::cswap (T &a, T &b) noexcept(IsNumeric< T >::value)
 Swapping two conjugated values/objects. More...
 
template<bool RF, typename T1 , typename T2 >
constexpr bool blaze::equal (const T1 &a, const T2 &b)
 Generic equality check. More...
 
template<typename T1 , typename T2 >
constexpr bool blaze::equal (const T1 &a, const T2 &b)
 Generic equality check. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_< Or< IsBuiltin< T >, IsComplex< T > >, const T &> blaze::eval (const T &a) noexcept
 Formal evaluation of the given argument. More...
 
template<typename T , typename = EnableIf_< IsBuiltin<T> >>
auto blaze::invcbrt (T a) noexcept -> decltype(inv(cbrt(a)))
 Returns the inverse cubic root of the given built-in value. More...
 
BLAZE_ALWAYS_INLINE float blaze::inv (float a) noexcept
 Inverting the given single precision value. More...
 
BLAZE_ALWAYS_INLINE double blaze::inv (double a) noexcept
 Inverting the given double precision value. More...
 
BLAZE_ALWAYS_INLINE long double blaze::inv (long double a) noexcept
 Inverting the given extended precision value. More...
 
BLAZE_ALWAYS_INLINE complex< float > blaze::inv (const complex< float > &a) noexcept
 Inverting the given single precision complex number. More...
 
BLAZE_ALWAYS_INLINE complex< double > blaze::inv (const complex< double > &a) noexcept
 Inverting the given double precision complex number. More...
 
BLAZE_ALWAYS_INLINE complex< long double > blaze::inv (const complex< long double > &a) noexcept
 Inverting the given extended precision complex number. More...
 
BLAZE_ALWAYS_INLINE void blaze::invert (float &a) noexcept
 In-place inversion of the given single precision value. More...
 
BLAZE_ALWAYS_INLINE void blaze::invert (double &a) noexcept
 In-place inversion of the given double precision value. More...
 
BLAZE_ALWAYS_INLINE void blaze::invert (long double &a) noexcept
 In-place inversion of the given extended precision value. More...
 
BLAZE_ALWAYS_INLINE void blaze::invert (complex< float > &a) noexcept
 In-place inversion of the given single precision complex number. More...
 
BLAZE_ALWAYS_INLINE void blaze::invert (complex< double > &a) noexcept
 In-place inversion of the given double precision complex number. More...
 
BLAZE_ALWAYS_INLINE void blaze::invert (complex< long double > &a) noexcept
 In-place inversion of the given extended precision complex number. More...
 
template<typename T , typename = EnableIf_< IsBuiltin<T> >>
auto blaze::invsqrt (T a) noexcept -> decltype(inv(sqrt(a)))
 Returns the inverse square root of the given built-in value. More...
 
template<typename T , typename = EnableIf_< IsBuiltin<T> >>
auto blaze::invsqrt (const complex< T > &a) noexcept -> decltype(inv(sqrt(a)))
 Returns the inverse square root of the given complex number. More...
 
template<bool RF, typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isDefault (const Type &v) noexcept(IsBuiltin< Type >::value)
 Returns whether the given value/object is in default state. More...
 
template<typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isDefault (const Type &v) noexcept(IsBuiltin< Type >::value)
 Returns whether the given value/object is in default state. More...
 
template<typename Type , typename = EnableIf_< IsNumeric<Type> >>
BLAZE_ALWAYS_INLINE bool blaze::isDivisor (const Type &v)
 Returns whether the given value/object is a valid divisor. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE EnableIf_< IsNumeric< T >, bool > blaze::isnan (T a) noexcept
 Platform independent implementation of the C99 isnan function. More...
 
template<bool RF, typename Type >
BLAZE_ALWAYS_INLINE EnableIf_< IsNumeric< Type >, bool > blaze::isOne (const Type &v)
 Returns whether the given value/object represents the numeric value 1. More...
 
template<typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isOne (const Type &v)
 Returns whether the given value/object represents the numeric value 1. More...
 
template<bool RF, typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isReal (const Type &v) noexcept
 Returns whether the given value/object represents a real number. More...
 
template<typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isReal (const Type &v) noexcept
 Returns whether the given value/object represents a real number. More...
 
template<bool RF, typename Type >
BLAZE_ALWAYS_INLINE EnableIf_< IsNumeric< Type >, bool > blaze::isZero (const Type &v) noexcept
 Returns whether the given value/object represents the numeric value 0. More...
 
template<typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isZero (const Type &v) noexcept
 Returns whether the given value/object represents the numeric value 0. More...
 
template<typename Type >
BLAZE_ALWAYS_INLINE void blaze::reset (Type &resettable)
 Resetting the given value/object to the default value. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_< Or< IsBuiltin< T >, IsComplex< T > >, const T &> blaze::serial (const T &a) noexcept
 Formal serialization of the evaluation of the given argument. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE constexpr MultExprTrait_< T, T > blaze::sq (const T &a) noexcept(noexcept(a *a))
 Squaring the given value/object. More...
 

Detailed Description

Function Documentation

◆ clear()

template<typename Type >
BLAZE_ALWAYS_INLINE void blaze::clear ( Type &  clearable)

Clearing the given value/object to the default state.

Parameters
clearableThe value/object to be cleared.
Returns
void

The clear shim represents an abstract interface for clearing a value/object of any given data type to its default state. Values of built-in data type are reset to zero.

◆ conj()

template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_< IsBuiltin<T>, T > blaze::conj ( a)
noexcept

Computing the conjugate of the given value/object.

Parameters
aThe given value/object.
Returns
The complex conjugate of the given value.

The conj shim represents an abstract interface for the computation of the complex conjugate of any given data type. In case the given value is of complex type the function computes the complex conjugate by reversing the sign of the imaginary part:

const blaze::complex<double> a( 1.0, 2.0 );
const blaze::complex<double> b( conj( a ) ); // Results in ( 1, -2 )

Values of other data types, such as all built-in data types, are considered complex numbers with an imaginary part of 0. Thus the returned value corresponds to the given value. For more information on complex conjugates, see

https://en.wikipedia.org/wiki/Complex_conjugate

◆ conjugate()

template<typename T >
BLAZE_ALWAYS_INLINE void blaze::conjugate ( T &  a)
noexcept

In-place conjugation of the given value/object.

Parameters
aThe given value/object to be conjugated.
Returns
void

The conjugate shim represents an abstract interface for the in-place conjugation of any given value/object. In case the given value is of complex type the function computes the complex conjugate by reversing the sign of the imaginary part:

blaze::complex<double> a( 1.0, 2.0 );
conjugate( a ); // Results in ( 1, -2 )

Values of other data types, such as all built-in data types, are considered complex numbers with an imaginary part of 0. Thus the returned value corresponds to the given value. For more information on complex conjugates, see

https://en.wikipedia.org/wiki/Complex_conjugate

◆ cswap()

template<typename T >
BLAZE_ALWAYS_INLINE void blaze::cswap ( T &  a,
T &  b 
)
noexcept

Swapping two conjugated values/objects.

Parameters
aThe first value/object to be swapped and conjugated.
bThe second value/object to be swapped and conjugated.
Returns
void

The cswap shim implements the most efficient way to swap and conjugate two values/objects. Semantically cswap is equivalent to the following sequence of operations:

swap( a, b );
conjugate( a );
conjugate( b );

◆ equal() [1/2]

template<bool RF, typename T1 , typename T2 >
constexpr bool blaze::equal ( const T1 &  a,
const T2 &  b 
)
inline

Generic equality check.

Parameters
aFirst value/object.
bSecond value/object.
Returns
true if the two values/objects are equal, false if not.

The equal shim represents an abstract interface for testing two values/objects for equality. In case the two values/objects are equal, the function returns true, otherwise it returns false. Per default, the comparison of the two values/objects uses the equality operator operator==(). For built-in floating point data types the function either uses the equality comparison (strict semantics) or a special comparison is selected that takes the limited machine accuracy into account (relaxed semantics).

◆ equal() [2/2]

template<typename T1 , typename T2 >
constexpr bool blaze::equal ( const T1 &  a,
const T2 &  b 
)
inline

Generic equality check.

Parameters
aFirst value/object.
bSecond value/object.
Returns
true if the two values/objects are equal, false if not.

The equal shim represents an abstract interface for testing two values/objects for equality. In case the two values/objects are equal, the function returns true, otherwise it returns false. Per default, the comparison of the two values/objects uses the equality operator operator==(). For built-in floating point data types a special comparison is selected that takes the limited machine accuracy into account.

◆ eval()

template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_< Or< IsBuiltin<T>, IsComplex<T> >, const T& > blaze::eval ( const T &  a)
noexcept

Formal evaluation of the given argument.

Parameters
aThe value/object to be evaluated.
Returns
The evaluated value/object.

The eval shim represents an abstract interface for enforcing the evaluation of a value/object of any given data type. For data types that don't require an evaluation, as for instance built-in data types, the default behavior is not changed.

◆ inv() [1/6]

BLAZE_ALWAYS_INLINE float blaze::inv ( float  a)
noexcept

Inverting the given single precision value.

Parameters
aThe single precision value to be inverted.
Returns
The inverse of the given value.

The inv shim represents an abstract interface for inverting a value/object of any given data type. For single precision floating point values this results in $ \frac{1}{a} $.

Note
A division by zero is only checked by an user assert.

◆ inv() [2/6]

BLAZE_ALWAYS_INLINE double blaze::inv ( double  a)
noexcept

Inverting the given double precision value.

Parameters
aThe double precision value to be inverted.
Returns
The inverse of the given value.

The inv shim represents an abstract interface for inverting a value/object of any given data type. For double precision floating point values this results in $ \frac{1}{a} $.

Note
A division by zero is only checked by an user assert.

◆ inv() [3/6]

BLAZE_ALWAYS_INLINE long double blaze::inv ( long double  a)
noexcept

Inverting the given extended precision value.

Parameters
aThe extended precision value to be inverted.
Returns
The inverse of the given value.

The inv shim represents an abstract interface for inverting a value/object of any given data type. For extended precision floating point values this results in $ \frac{1}{a} $.

Note
A division by zero is only checked by an user assert.

◆ inv() [4/6]

BLAZE_ALWAYS_INLINE complex<float> blaze::inv ( const complex< float > &  a)
noexcept

Inverting the given single precision complex number.

Parameters
aThe single precision complex number to be inverted.
Returns
The inverse of the given value.

The inv shim represents an abstract interface for inverting a value/object of any given data type. For a single precision floating point complex number $ z = x + yi $ this results in $ \frac{\overline{z}}{x^2+y^2} $.

Note
A division by zero is only checked by an user assert.

◆ inv() [5/6]

BLAZE_ALWAYS_INLINE complex<double> blaze::inv ( const complex< double > &  a)
noexcept

Inverting the given double precision complex number.

Parameters
aThe double precision complex number to be inverted.
Returns
The inverse of the given value.

The inv shim represents an abstract interface for inverting a value/object of any given data type. For a double precision floating point complex number $ z = x + yi $ this results in $ \frac{\overline{z}}{x^2+y^2} $.

Note
A division by zero is only checked by an user assert.

◆ inv() [6/6]

BLAZE_ALWAYS_INLINE complex<long double> blaze::inv ( const complex< long double > &  a)
noexcept

Inverting the given extended precision complex number.

Parameters
aThe extended precision complex number to be inverted.
Returns
The inverse of the given value.

The inv shim represents an abstract interface for inverting a value/object of any given data type. For an extended precision floating point complex number $ z = x + yi $ this results in $ \frac{\overline{z}}{x^2+y^2} $.

Note
A division by zero is only checked by an user assert.

◆ invcbrt()

template<typename T , typename = EnableIf_< IsBuiltin<T> >>
auto blaze::invcbrt ( a) -> decltype( inv( cbrt( a ) ) )
inlinenoexcept

Returns the inverse cubic root of the given built-in value.

Parameters
aThe given built-in value $[0..\infty)$.
Returns
The inverse cubic root of the given value.
Note
The given value must be in the range $[0..\infty)$. The validity of the value is only checked by an user assert.

◆ invert() [1/6]

BLAZE_ALWAYS_INLINE void blaze::invert ( float &  a)
noexcept

In-place inversion of the given single precision value.

Parameters
aThe single precision value to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type in-place. For single precision floating point values this results in $ \frac{1}{a} $.

Note
A division by zero is only checked by an user assert.

◆ invert() [2/6]

BLAZE_ALWAYS_INLINE void blaze::invert ( double &  a)
noexcept

In-place inversion of the given double precision value.

Parameters
aThe double precision value to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type in-place. For double precision floating point values this results in $ \frac{1}{a} $.

Note
A division by zero is only checked by an user assert.

◆ invert() [3/6]

BLAZE_ALWAYS_INLINE void blaze::invert ( long double &  a)
noexcept

In-place inversion of the given extended precision value.

Parameters
aThe extended precision value to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type in-place. For extended precision floating point values this results in $ \frac{1}{a} $.

Note
A division by zero is only checked by an user assert.

◆ invert() [4/6]

BLAZE_ALWAYS_INLINE void blaze::invert ( complex< float > &  a)
noexcept

In-place inversion of the given single precision complex number.

Parameters
aThe single precision complex number to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type in-place. For a single precision floating point complex number $ z = x + yi $ this results in $ \frac{\overline{z}}{x^2+y^2} $.

Note
A division by zero is only checked by an user assert.

◆ invert() [5/6]

BLAZE_ALWAYS_INLINE void blaze::invert ( complex< double > &  a)
noexcept

In-place inversion of the given double precision complex number.

Parameters
aThe double precision complex number to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type in-place. For a double precision floating point complex number $ z = x + yi $ this results in $ \frac{\overline{z}}{x^2+y^2} $.

Note
A division by zero is only checked by an user assert.

◆ invert() [6/6]

BLAZE_ALWAYS_INLINE void blaze::invert ( complex< long double > &  a)
noexcept

In-place inversion of the given extended precision complex number.

Parameters
aThe extended precision complex number to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type in-place. For an extended precision floating point complex number $ z = x + yi $ this results in $ \frac{\overline{z}}{x^2+y^2} $.

Note
A division by zero is only checked by an user assert.

◆ invsqrt() [1/2]

template<typename T , typename = EnableIf_< IsBuiltin<T> >>
auto blaze::invsqrt ( a) -> decltype( inv( sqrt( a ) ) )
inlinenoexcept

Returns the inverse square root of the given built-in value.

Parameters
aThe given built-in value $[0..\infty)$.
Returns
The inverse square root of the given value.
Note
The given value must be in the range $[0..\infty)$. The validity of the value is only checked by an user assert.

◆ invsqrt() [2/2]

template<typename T , typename = EnableIf_< IsBuiltin<T> >>
auto blaze::invsqrt ( const complex< T > &  a) -> decltype( inv( sqrt( a ) ) )
inlinenoexcept

Returns the inverse square root of the given complex number.

Parameters
aThe given complex number.
Returns
The inverse square root of the given complex number.
Note
The given complex number must not be zero. The validity of the value is only checked by an user assert.

◆ isDefault() [1/2]

template<bool RF, typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isDefault ( const Type &  v)
noexcept

Returns whether the given value/object is in default state.

Parameters
vThe value/object to be tested for its default state.
Returns
true in case the given value/object is in its default state, false otherwise.

The isDefault shim represents an abstract interface for testing a value/object whether it is in its default state or not. In case the value/object is in its default state, the function returns true, otherwise it returns false. For integral built-in data types, the function returns true in case the current value is zero:

int i1 = 0; // isDefault( i1 ) returns true
int i2 = 1; // isDefault( i2 ) returns false

For floating point built-in data types, the function by default uses relaxed semantics and returns true in case the current value is close to zero within a certain accuracy:

double d1 = 0.0; // isDefault( d1 ) returns true
double d2 = 1E-9; // isDefault( d2 ) returns true since d2 is below 1E-8
double d3 = 1.0; // isDefault( d3 ) returns false

Optionally, it is possible to switch between relaxed semantics (blaze::relaxed) and strict semantics (blaze::strict). In case of strict semantics, for floating point built-in data types the function returns true in case the current value is exactly zero:

// isDefault<strict>( ... ) | isDefault<relaxed>( ... )
double d1 = 0.0; // true | true
double d2 = 1E-9; // false (not 0.0) | true (below 1E-8)
double d3 = 1.0; // false | false

◆ isDefault() [2/2]

template<typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isDefault ( const Type &  v)
noexcept

Returns whether the given value/object is in default state.

Parameters
vThe value/object to be tested for its default state.
Returns
true in case the given value/object is in its default state, false otherwise.

The isDefault shim represents an abstract interface for testing a value/object whether it is in its default state or not. In case the value/object is in its default state, the function returns true, otherwise it returns false. For integral built-in data types, the function returns true in case the current value is zero:

int i1 = 0; // isDefault( i1 ) returns true
int i2 = 1; // isDefault( i2 ) returns false

For floating point built-in data types, the function by default uses relaxed semantics and returns true in case the current value is close to zero within a certain accuracy:

double d1 = 0.0; // isDefault( d1 ) returns true
double d2 = 1E-9; // isDefault( d2 ) returns true since d2 is below 1E-8
double d3 = 1.0; // isDefault( d3 ) returns false

Optionally, it is possible to switch between relaxed semantics (blaze::relaxed) and strict semantics (blaze::strict). In case of strict semantics, for floating point built-in data types the function returns true in case the current value is exactly zero:

// isDefault<strict>( ... ) | isDefault<relaxed>( ... )
double d1 = 0.0; // true | true
double d2 = 1E-9; // false (not 0.0) | true (below 1E-8)
double d3 = 1.0; // false | false

◆ isDivisor()

template<typename Type , typename = EnableIf_< IsNumeric<Type> >>
BLAZE_ALWAYS_INLINE bool blaze::isDivisor ( const Type &  v)

Returns whether the given value/object is a valid divisor.

Parameters
vThe value to be tested.
Returns
true in case the given value is a valid divisor, false otherwise.

The isDivisor shim provides an abstract interface for testing a value/object of any type whether it represents a valid divisor. In case the value/object can be used as divisor, the function returns true, otherwise it returns false.

const int i1 = 1; // isDivisor( i1 ) returns true
double d1 = 0.1; // isDivisor( d1 ) returns true
complex<double> c1( 0.2, -0.1 ); // isDivisor( c1 ) returns true
const int i2 = 0; // isDivisor( i2 ) returns false
double d2 = 0.0; // isDivisor( d2 ) returns false
complex<double> c2( 0.0, 0.0 ); // isDivisor( c2 ) returns false

◆ isnan()

template<typename T >
BLAZE_ALWAYS_INLINE EnableIf_< IsNumeric<T>, bool > blaze::isnan ( a)
noexcept

Platform independent implementation of the C99 isnan function.

Parameters
aValue to be checked.
Returns
true if a is not a number (NaN), false otherwise.

This function provides a platform independent check for NaN values. In contrast to the isnan function from the C standard, which is only supporting all floating point types, this function can be used for all numeric data types (i.e. all integral, floating point, and complex data types). The function returns true in case the given value is not a number (NaN). In all other cases the function returns false.

◆ isOne() [1/2]

template<bool RF, typename Type >
BLAZE_ALWAYS_INLINE EnableIf_< IsNumeric<Type>, bool > blaze::isOne ( const Type &  v)

Returns whether the given value/object represents the numeric value 1.

Parameters
vThe value to be tested.
Returns
true in case the given value is 1, false otherwise.

The isOne shim provides an abstract interface for testing a value/object of any type whether it represents the numeric value 1. In case the value/object is 1, the function returns true, otherwise it returns false:

int i1 = 0; // isZero( i1 ) returns false
int i2 = 1; // isZero( i2 ) returns true

For floating point built-in data types, the function by default uses relaxed semantics and returns true in case the current value is close to 1 within a certain accuracy:

double d1 = 0.0; // isZero( d1 ) returns false
double d2 = 1.0 + 1E-9; // isZero( d2 ) returns true
double d3 = 1.0; // isZero( d3 ) returns true
complex<double> c1( 0.0, 0.0 ); // isZero( c1 ) returns false
complex<double> c2( 1.0+1E-9, 0.0 ); // isZero( c2 ) returns true
complex<double> c3( 1.0, 0.0 ); // isZero( c3 ) returns true
complex<double> c4( 0.0, 1.0 ); // isZero( c4 ) returns false

Optionally, it is possible to switch between relaxed semantics (blaze::relaxed) and strict semantics (blaze::strict). In case of strict semantics, for floating point built-in data types the function returns true in case the current value is exactly 1:

// isOne<strict>( ... ) | isOne<relaxed>( ... )
double d1 = 0.0; // false | false
double d2 = 1.0 + 1E-9; // false (not 1.0) | true
double d3 = 1.0; // true | true
complex<double> c1( 0.0, 0.0 ); // false | false
complex<double> c2( 1.0+1E-9, 0.0 ); // false | true
complex<double> c3( 1.0, 0.0 ); // true | true
complex<double> c4( 0.0, 1.0 ); // false | false

◆ isOne() [2/2]

template<typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isOne ( const Type &  v)

Returns whether the given value/object represents the numeric value 1.

Parameters
vThe value to be tested.
Returns
true in case the given value is 1, false otherwise.

The isOne shim provides an abstract interface for testing a value/object of any type whether it represents the numeric value 1. In case the value/object is 1, the function returns true, otherwise it returns false:

int i1 = 0; // isZero( i1 ) returns false
int i2 = 1; // isZero( i2 ) returns true

For floating point built-in data types, the function by default uses relaxed semantics and returns true in case the current value is close to 1 within a certain accuracy:

double d1 = 0.0; // isZero( d1 ) returns false
double d2 = 1.0 + 1E-9; // isZero( d2 ) returns true
double d3 = 1.0; // isZero( d3 ) returns true
complex<double> c1( 0.0, 0.0 ); // isZero( c1 ) returns false
complex<double> c2( 1.0+1E-9, 0.0 ); // isZero( c2 ) returns true
complex<double> c3( 1.0, 0.0 ); // isZero( c3 ) returns true
complex<double> c4( 0.0, 1.0 ); // isZero( c4 ) returns false

Optionally, it is possible to switch between relaxed semantics (blaze::relaxed) and strict semantics (blaze::strict). In case of strict semantics, for floating point built-in data types the function returns true in case the current value is exactly 1:

// isOne<strict>( ... ) | isOne<relaxed>( ... )
double d1 = 0.0; // false | false
double d2 = 1.0 + 1E-9; // false (not 1.0) | true
double d3 = 1.0; // true | true
complex<double> c1( 0.0, 0.0 ); // false | false
complex<double> c2( 1.0+1E-9, 0.0 ); // false | true
complex<double> c3( 1.0, 0.0 ); // true | true
complex<double> c4( 0.0, 1.0 ); // false | false

◆ isReal() [1/2]

template<bool RF, typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isReal ( const Type &  v)
noexcept

Returns whether the given value/object represents a real number.

Parameters
vThe value to be tested.
Returns
true in case the given value represents a real number, false otherwise.

The isReal shim provides an abstract interface for testing a value/object of any type whether it represents the a real number. In case the value/object is of built-in type, the function returns true:

int i = 1; // isReal( i ) returns true
double d = 1.0; // isReal( d ) returns true

In case the value/object is of complex type, the function returns true if the imaginary part is close to 0 (relaxed semantics):

complex<double> c1( 1.0, 0.0 ); // isReal( c1 ) returns true
complex<double> c2( 0.0, 1.0 ); // isReal( c2 ) returns false

Optionally, it is possible to switch between relaxed semantics (blaze::relaxed) and strict semantics (blaze::strict). In case of strict semantics, for complex types the function returns true in case the imaginary part is exactly zero:

// isReal<strict>( ... ) | isReal<relaxed>( ... )
complex<double> c1( 1.0, 0.0 ); // true | true
complex<double> c2( 1.0, 1E-9 ); // false | true (below 1E-8)
complex<double> c3( 0.0, 1.0 ); // false | false

For all other types the function returns false.

◆ isReal() [2/2]

template<typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isReal ( const Type &  v)
noexcept

Returns whether the given value/object represents a real number.

Parameters
vThe value to be tested.
Returns
true in case the given value represents a real number, false otherwise.

The isReal shim provides an abstract interface for testing a value/object of any type whether it represents the a real number. In case the value/object is of built-in type, the function returns true. In case the value/object is of complex type, the function returns true if the imaginary part is equal to 0. Otherwise it returns false.

int i = 1; // isReal( i ) returns true
double d = 1.0; // isReal( d ) returns true
complex<double> c1( 1.0, 0.0 ); // isReal( c1 ) returns true
complex<double> c2( 0.0, 1.0 ); // isReal( c2 ) returns false
blaze::DynamicVector<int> vec; // isReal( vec ) returns false
blaze::DynamicMatrix<double> mat; // isReal( mat ) returns false

◆ isZero() [1/2]

template<bool RF, typename Type >
BLAZE_ALWAYS_INLINE EnableIf_< IsNumeric<Type>, bool > blaze::isZero ( const Type &  v)
noexcept

Returns whether the given value/object represents the numeric value 0.

Parameters
vThe value to be tested.
Returns
true in case the given value is 0, false otherwise.

The isZero shim provides an abstract interface for testing a value/object of any type whether it represents the numeric value 0. In case the value/object is 0, the function returns true, otherwise it returns false:

int i1 = 0; // isZero( i1 ) returns true
int i2 = 1; // isZero( i2 ) returns false

For floating point built-in data types, the function by default uses relaxed semantics and returns true in case the current value is close to zero within a certain accuracy:

double d1 = 0.0; // isZero( d1 ) returns true
double d2 = 1E-9; // isZero( d2 ) returns true since d2 is below 1E-8
double d3 = 1.0; // isZero( d3 ) returns false
complex<double> c1( 0.0, 0.0 ); // isZero( c1 ) returns true
complex<double> c2( 0.0, 1E-9 ); // isZero( c2 ) returns true since imag(c2) is below 1E-8
complex<double> c3( 1.0, 0.0 ); // isZero( c3 ) returns false

Optionally, it is possible to switch between relaxed semantics (blaze::relaxed) and strict semantics (blaze::strict). In case of strict semantics, for floating point built-in data types the function returns true in case the current value is exactly zero:

// isZero<strict>( ... ) | isZero<relaxed>( ... )
double d1 = 0.0; // true | true
double d2 = 1E-9; // false (not 0.0) | true (below 1E-8)
double d3 = 1.0; // false | false
complex<double> c1( 0.0, 0.0 ); // true | true
complex<double> c2( 0.0, 1E-9 ); // false | true (below 1E-8)
complex<double> c3( 1.0, 0.0 ); // false | false

◆ isZero() [2/2]

template<typename Type >
BLAZE_ALWAYS_INLINE bool blaze::isZero ( const Type &  v)
noexcept

Returns whether the given value/object represents the numeric value 0.

Parameters
vThe value to be tested.
Returns
true in case the given value is 0, false otherwise.

The isZero shim provides an abstract interface for testing a value/object of any type whether it represents the numeric value 0. In case the value/object is 0, the function returns true, otherwise it returns false:

int i1 = 0; // isZero( i1 ) returns true
int i2 = 1; // isZero( i2 ) returns false

For floating point built-in data types, the function by default uses relaxed semantics and returns true in case the current value is close to zero within a certain accuracy:

double d1 = 0.0; // isZero( d1 ) returns true
double d2 = 1E-9; // isZero( d2 ) returns true since d2 is below 1E-8
double d3 = 1.0; // isZero( d3 ) returns false
complex<double> c1( 0.0, 0.0 ); // isZero( c1 ) returns true
complex<double> c2( 0.0, 1E-9 ); // isZero( c2 ) returns true since imag(c2) is below 1E-8
complex<double> c3( 1.0, 0.0 ); // isZero( c3 ) returns false

Optionally, it is possible to switch between relaxed semantics (blaze::relaxed) and strict semantics (blaze::strict). In case of strict semantics, for floating point built-in data types the function returns true in case the current value is exactly zero:

// isZero<strict>( ... ) | isZero<relaxed>( ... )
double d1 = 0.0; // true | true
double d2 = 1E-9; // false (not 0.0) | true (below 1E-8)
double d3 = 1.0; // false | false
complex<double> c1( 0.0, 0.0 ); // true | true
complex<double> c2( 0.0, 1E-9 ); // false | true (below 1E-8)
complex<double> c3( 1.0, 0.0 ); // false | false

◆ reset()

template<typename Type >
BLAZE_ALWAYS_INLINE void blaze::reset ( Type &  resettable)

Resetting the given value/object to the default value.

Parameters
resettableThe value/object to be resetted.
Returns
void

The reset shim represents an abstract interface for the resetting of a value/object of any given data type to its default value. Values of built-in data type are reset to zero.

◆ serial()

template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_< Or< IsBuiltin<T>, IsComplex<T> >, const T& > blaze::serial ( const T &  a)
noexcept

Formal serialization of the evaluation of the given argument.

Parameters
aThe value/object to be evaluated serially.
Returns
The serialized operation.

The serial shim represents an abstract interface for the serialization of the evaluation of a value/object of any given data type. For data types that are per default evaluated serially, as for instance built-in data types, the default behavior is not changed.

◆ sq()

template<typename T >
BLAZE_ALWAYS_INLINE constexpr MultExprTrait_<T,T> blaze::sq ( const T &  a)
noexcept

Squaring the given value/object.

Parameters
aThe value/object to be squared.
Returns
The result of the square operation.

The sq shim represents an abstract interface for squaring a value/object of any given data type. For values of built-in data type this results in a plain multiplication.