Conjugate.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SHIMS_CONJUGATE_H_
36 #define _BLAZE_MATH_SHIMS_CONJUGATE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
44 #include <blaze/system/Inline.h>
45 #include <blaze/util/DisableIf.h>
46 #include <blaze/util/EnableIf.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // CONJ SHIM
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
81 template< typename T >
82 BLAZE_ALWAYS_INLINE constexpr EnableIf_t< IsBuiltin_v<T>, T > conj( T a ) noexcept
83 {
84  return a;
85 }
86 //*************************************************************************************************
87 
88 
89 
90 
91 //=================================================================================================
92 //
93 // CONJUGATE SHIM
94 //
95 //=================================================================================================
96 
97 //*************************************************************************************************
119 template< typename T >
120 BLAZE_ALWAYS_INLINE void conjugate( T& a ) noexcept( IsNumeric_v<T> )
121 {
122  a = conj( a );
123 }
124 //*************************************************************************************************
125 
126 
127 
128 
129 //=================================================================================================
130 //
131 // CSWAP SHIM
132 //
133 //=================================================================================================
134 
135 //*************************************************************************************************
144 template< typename T >
145 BLAZE_ALWAYS_INLINE DisableIf_t< IsNumeric_v<T> > cswap_backend( T& a, T& b )
146 {
147  using std::swap;
148 
149  swap( a, b );
150  conjugate( a );
151  conjugate( b );
152 }
154 //*************************************************************************************************
155 
156 
157 //*************************************************************************************************
166 template< typename T >
167 BLAZE_ALWAYS_INLINE EnableIf_t< IsNumeric_v<T> > cswap_backend( T& a, T& b ) noexcept
168 {
169  const T tmp( a );
170  a = conj( b );
171  b = conj( tmp );
172 }
174 //*************************************************************************************************
175 
176 
177 //*************************************************************************************************
194 template< typename T >
195 BLAZE_ALWAYS_INLINE void cswap( T& a, T& b ) noexcept( IsNumeric_v<T> )
196 {
197  cswap_backend( a, b );
198 }
199 //*************************************************************************************************
200 
201 } // namespace blaze
202 
203 #endif
BLAZE_ALWAYS_INLINE void cswap(T &a, T &b) noexcept(IsNumeric_v< T >)
Swapping two conjugated values/objects.
Definition: Conjugate.h:195
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric_v< T >)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:281
Header file for the IsBuiltin type trait.
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1326
System settings for the inline keywords.