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 
44 #include <blaze/system/Inline.h>
45 #include <blaze/util/Complex.h>
46 #include <blaze/util/DisableIf.h>
47 #include <blaze/util/EnableIf.h>
50 #include <blaze/util/Unused.h>
51 
52 
53 namespace blaze {
54 
55 //=================================================================================================
56 //
57 // ISREAL SHIM
58 //
59 //=================================================================================================
60 
61 //*************************************************************************************************
69 template< typename Type >
70 BLAZE_ALWAYS_INLINE typename EnableIf< IsBuiltin<Type>, bool >::Type
71  isReal_backend( const Type& v )
72 {
73  UNUSED_PARAMETER( v );
74 
75  return true;
76 }
78 //*************************************************************************************************
79 
80 
81 //*************************************************************************************************
89 template< typename Type >
90 BLAZE_ALWAYS_INLINE bool isReal_backend( const complex<Type>& v )
91 {
92  return isDefault( v.imag() );
93 }
95 //*************************************************************************************************
96 
97 
98 //*************************************************************************************************
106 template< typename Type >
107 BLAZE_ALWAYS_INLINE typename DisableIf< IsNumeric<Type>, bool >::Type
108  isReal_backend( const Type& v )
109 {
110  UNUSED_PARAMETER( v );
111 
112  return false;
113 }
115 //*************************************************************************************************
116 
117 
118 //*************************************************************************************************
141 template< typename Type >
142 BLAZE_ALWAYS_INLINE bool isReal( const Type& v )
143 {
144  return isReal_backend( v );
145 }
146 //*************************************************************************************************
147 
148 } // namespace blaze
149 
150 #endif
Header file for the UNUSED_PARAMETER function template.
bool isReal(const DiagonalProxy< MT > &proxy)
Returns whether the matrix element represents a real number.
Definition: DiagonalProxy.h:569
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
Header file for the isDefault shim.
Header file for the IsBuiltin type trait.
Header file for the complex data type.
System settings for the inline keywords.