Functions

Functions

template<typename Type >
BLAZE_ALWAYS_INLINE constexpr void blaze::clear (Type &clearable)
 Clearing the given value/object to the default state. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_t< IsBuiltin_v< 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_v< T >)
 In-place conjugation of the given value/object. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE void blaze::cswap (T &a, T &b) noexcept(IsNumeric_v< T >)
 Swapping two conjugated values/objects. More...
 
template<typename T >
constexpr size_t blaze::digits (T a) noexcept
 Returns the number of valid digits of an integral value. More...
 
template<bool RF, typename T1 , typename T2 , typename = EnableIf_t< ( IsSigned_v<T1> && IsSigned_v<T2> ) || ( IsUnsigned_v<T1> && IsUnsigned_v<T2> ) >>
constexpr bool blaze::equal (const T1 &a, const T2 &b)
 Generic equality comparison. 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_t< IsBuiltin_v< T >||IsComplex_v< T >, const T &> blaze::eval (const T &a) noexcept
 Formal evaluation of the given argument. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_t< IsBuiltin_v< T >||IsComplex_v< T >, T > blaze::evaluate (const T &a) noexcept
 Formal evaluation of the given argument. More...
 
template<typename T , typename = EnableIf_t< IsBuiltin_v<T> >>
decltype(auto) BLAZE_ALWAYS_INLINE blaze::exp10 (const T &a) noexcept(noexcept(pow(T(10), a)))
 Returns the base-10 exponent of the given built-in value. More...
 
template<typename T1 , typename T2 >
BLAZE_ALWAYS_INLINE constexpr bool blaze::greater (const T1 &a, const T2 &b) noexcept(IsBuiltin_v< CommonType_t< T1, T2 > >)
 Generic greater-than comparison. More...
 
template<typename T , typename = EnableIf_t< IsBuiltin_v<T> >>
auto blaze::invcbrt (T a) noexcept -> decltype(inv(cbrt(a)))
 Returns the inverse cubic root of the given built-in value. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_t< IsIntegral_v< T >, double > blaze::inv (T a) noexcept
 Inverting the given integral value. More...
 
BLAZE_ALWAYS_INLINE constexpr float blaze::inv (float a) noexcept
 Inverting the given single precision value. More...
 
BLAZE_ALWAYS_INLINE constexpr double blaze::inv (double a) noexcept
 Inverting the given double precision value. More...
 
BLAZE_ALWAYS_INLINE constexpr long double blaze::inv (long double a) noexcept
 Inverting the given extended precision value. More...
 
BLAZE_ALWAYS_INLINE constexpr complex< float > blaze::inv (const complex< float > &a) noexcept
 Inverting the given single precision complex number. More...
 
BLAZE_ALWAYS_INLINE constexpr complex< double > blaze::inv (const complex< double > &a) noexcept
 Inverting the given double precision complex number. More...
 
BLAZE_ALWAYS_INLINE constexpr 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_t< IsBuiltin_v<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_t< IsBuiltin_v<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_v< Type >)
 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_v< Type >)
 Returns whether the given value/object is in default state. More...
 
template<typename Type , typename = EnableIf_t< IsNumeric_v<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_t< IsNumeric_v< 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_t< IsNumeric_v< 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_t< IsNumeric_v< 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 T1 , typename T2 >
BLAZE_ALWAYS_INLINE constexpr bool blaze::less (const T1 &a, const T2 &b) noexcept(IsBuiltin_v< CommonType_t< T1, T2 > >)
 Generic less-than comparison. More...
 
template<typename T >
BLAZE_ALWAYS_INLINEdecltype(auto) constexpr blaze::pow2 (const T &a) noexcept(noexcept(a *a))
 Squaring the given value/object. More...
 
template<typename T >
BLAZE_ALWAYS_INLINEdecltype(auto) constexpr blaze::pow3 (const T &a) noexcept(noexcept(a *a *a))
 Cubing the given value/object. More...
 
template<typename T >
BLAZE_ALWAYS_INLINEdecltype(auto) constexpr blaze::pow4 (const T &a) noexcept(noexcept(pow2(pow2(a))))
 Quadruple the given value/object. More...
 
template<typename T >
decltype(auto) BLAZE_ALWAYS_INLINE blaze::qdrt (const T &a)
 Computing the quad root (4th root) of the given value/object. More...
 
template<typename Type >
BLAZE_ALWAYS_INLINE constexpr void blaze::reset (Type &resettable)
 Resetting the given value/object to the default value. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_t< IsBuiltin_v< T >||IsComplex_v< T >, const T &> blaze::serial (const T &a) noexcept
 Formal serialization of the evaluation of the given argument. More...
 
template<typename T , typename = EnableIf_t< IsBuiltin_v<T> >>
constexpr T blaze::sign (T a) noexcept
 Evaluating the sign of the given value. More...
 

Detailed Description

Function Documentation

◆ clear()

template<typename Type >
BLAZE_ALWAYS_INLINE constexpr 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_t< IsBuiltin_v<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 );

◆ digits()

template<typename T >
constexpr size_t blaze::digits ( a)
inlinenoexcept

Returns the number of valid digits of an integral value.

Parameters
aThe integral value.
Returns
The number of valid digits.

This function counts the number of valid digits in the given integral value.

digits( 100 ); // Returns 3
digits( 12345 ); // Returns 5
digits( 0 ); // Returns 0

The digits function only works for integral built-in data types. The attempt to use any other type will result in a compile time error.

◆ equal() [1/2]

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

Generic equality comparison.

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. Based on the setting of the relaxation flag RF, the function either performs a comparison via the equality operator (blaze::strict) or or a special comparison is selected that takes the limited machine accuracy into account (blaze::relaxed). In case the two values/objects are equal, the function returns true, otherwise it returns false.

◆ 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_t< IsBuiltin_v<T> || IsComplex_v<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.

◆ evaluate()

template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_t< IsBuiltin_v<T> || IsComplex_v<T>, T > blaze::evaluate ( const T &  a)
noexcept

Formal evaluation of the given argument.

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

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

◆ exp10()

template<typename T , typename = EnableIf_t< IsBuiltin_v<T> >>
decltype(auto) BLAZE_ALWAYS_INLINE blaze::exp10 ( const T &  a)
noexcept

Returns the base-10 exponent of the given built-in value.

Parameters
aThe given built-in value.
Returns
The base-10 exponent of the given value.

◆ greater()

template<typename T1 , typename T2 >
BLAZE_ALWAYS_INLINE constexpr bool blaze::greater ( const T1 &  a,
const T2 &  b 
)
noexcept

Generic greater-than comparison.

Parameters
aFirst value.
bSecond value.
Returns
true if the first value is greater than the second, false if not.

Generic greater-than comparison between to numeric values. Depending on the types of the two arguments, a special comparison for floating point values is selected that takes the limited machine accuracy into account.

◆ inv() [1/7]

template<typename T >
BLAZE_ALWAYS_INLINE constexpr EnableIf_t< IsIntegral_v<T>, double > blaze::inv ( a)
noexcept

Inverting the given integral value.

Parameters
aThe integral 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 integral values this results in $ \frac{1}{a} $.

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

◆ inv() [2/7]

BLAZE_ALWAYS_INLINE constexpr 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() [3/7]

BLAZE_ALWAYS_INLINE constexpr 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() [4/7]

BLAZE_ALWAYS_INLINE constexpr 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() [5/7]

BLAZE_ALWAYS_INLINE constexpr 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() [6/7]

BLAZE_ALWAYS_INLINE constexpr 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() [7/7]

BLAZE_ALWAYS_INLINE constexpr 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_t< IsBuiltin_v<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_t< IsBuiltin_v<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_t< IsBuiltin_v<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_t< IsNumeric_v<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_t< IsNumeric_v<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_t< IsNumeric_v<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_t< IsNumeric_v<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

◆ less()

template<typename T1 , typename T2 >
BLAZE_ALWAYS_INLINE constexpr bool blaze::less ( const T1 &  a,
const T2 &  b 
)
noexcept

Generic less-than comparison.

Parameters
aFirst value.
bSecond value.
Returns
true if the first value is less than the second, false if not.

Generic less-than comparison between to numeric values. Depending on the types of the two arguments, a special comparison for floating point values is selected that takes the limited machine accuracy into account.

◆ pow2()

template<typename T >
BLAZE_ALWAYS_INLINEdecltype(auto) constexpr blaze::pow2 ( const T &  a)
noexcept

Squaring the given value/object.

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

The pow2 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.

◆ pow3()

template<typename T >
BLAZE_ALWAYS_INLINEdecltype(auto) constexpr blaze::pow3 ( const T &  a)
noexcept

Cubing the given value/object.

Parameters
aThe value/object to be cubed.
Returns
The result of the cube operation.

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

◆ pow4()

template<typename T >
BLAZE_ALWAYS_INLINEdecltype(auto) constexpr blaze::pow4 ( const T &  a)
noexcept

Quadruple the given value/object.

Parameters
aThe value/object to be quadrupled.
Returns
The result of the quadruple operation.

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

◆ qdrt()

template<typename T >
decltype(auto) BLAZE_ALWAYS_INLINE blaze::qdrt ( const T &  a)

Computing the quad root (4th root) of the given value/object.

Parameters
aThe value/object for the computation.
Returns
The quad root (4th root) of the given value/object.

The qdrt shim represents an abstract interface for computing the quad root (i.e. 4th root) of a value/object of any given data type.

◆ reset()

template<typename Type >
BLAZE_ALWAYS_INLINE constexpr 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_t< IsBuiltin_v<T> || IsComplex_v<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.

◆ sign()

template<typename T , typename = EnableIf_t< IsBuiltin_v<T> >>
constexpr T blaze::sign ( a)
inlinenoexcept

Evaluating the sign of the given value.

Parameters
aThe given value.
Returns
1 if the value is greater than zero, 0 if it is zero, and -1 if it is less than zero.

The sign function evaluates the sign of the given value a of the built-in data type T. It returns 1 if a is greater than zero, 0 if a is zero, and -1 if a is less than zero.