Blaze 3.9
IsReal.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_SHIMS_ISREAL_H_
36#define _BLAZE_MATH_SHIMS_ISREAL_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
46#include <blaze/system/Inline.h>
47#include <blaze/util/Complex.h>
48#include <blaze/util/EnableIf.h>
51
52
53namespace blaze {
54
55//=================================================================================================
56//
57// ISREAL SHIM
58//
59//=================================================================================================
60
61//*************************************************************************************************
98template< RelaxationFlag RF // Relaxation flag
99 , typename Type // Type of the given value
100 , EnableIf_t< IsScalar_v<Type> >* = nullptr >
101BLAZE_ALWAYS_INLINE bool isReal( const Type& v ) noexcept
102{
103 MAYBE_UNUSED( v );
104
105 return IsBuiltin_v<Type>;
106}
107//*************************************************************************************************
108
109
110//*************************************************************************************************
118template< RelaxationFlag RF // Relaxation flag
119 , typename Type > // Type of the given value
120BLAZE_ALWAYS_INLINE bool isReal( const complex<Type>& v ) noexcept( IsBuiltin_v<Type> )
121{
122 return IsBuiltin_v<Type> && isZero<RF>( v.imag() );
123}
125//*************************************************************************************************
126
127
128//*************************************************************************************************
151template< typename Type >
152BLAZE_ALWAYS_INLINE bool isReal( const Type& v ) noexcept
153{
154 return isReal<relaxed>( v );
155}
156//*************************************************************************************************
157
158} // namespace blaze
159
160#endif
Header file for the complex data type.
Header file for the EnableIf class template.
Header file for the IsBuiltin type trait.
Header file for the IsScalar type trait.
Header file for the MAYBE_UNUSED function template.
Header file for the relaxation flag enumeration.
Complex data type of the Blaze library.
BLAZE_ALWAYS_INLINE bool isReal(const Type &v) noexcept
Returns whether the given value/object represents a real number.
Definition: IsReal.h:152
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the isZero shim.
System settings for the inline keywords.