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 <blaze/system/Inline.h>
44 #include <blaze/util/DisableIf.h>
45 #include <blaze/util/EnableIf.h>
48 
49 
50 namespace blaze {
51 
52 //=================================================================================================
53 //
54 // CONJ SHIM
55 //
56 //=================================================================================================
57 
58 //*************************************************************************************************
80 template< typename T >
81 BLAZE_ALWAYS_INLINE typename EnableIf< IsBuiltin<T>, T >::Type
82  conj( T a )
83 {
84  return a;
85 }
86 //*************************************************************************************************
87 
88 
89 
90 
91 //=================================================================================================
92 //
93 // CONJUGATE SHIM
94 //
95 //=================================================================================================
96 
97 //*************************************************************************************************
119 template< typename 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 typename DisableIf< IsNumeric<T> >::Type
146  cswap_backend( T& a, T& b )
147 {
148  using std::swap;
149 
150  swap( a, b );
151  conjugate( a );
152  conjugate( b );
153 }
155 //*************************************************************************************************
156 
157 
158 //*************************************************************************************************
167 template< typename T >
168 BLAZE_ALWAYS_INLINE typename EnableIf< IsNumeric<T> >::Type
169  cswap_backend( T& a, T& b )
170 {
171  const T tmp( a );
172  a = conj( b );
173  b = conj( tmp );
174 }
176 //*************************************************************************************************
177 
178 
179 //*************************************************************************************************
196 template< typename T >
197 BLAZE_ALWAYS_INLINE void cswap( T& a, T& b )
198 {
199  cswap_backend( a, b );
200 }
201 //*************************************************************************************************
202 
203 } // namespace blaze
204 
205 #endif
ConjExprTrait< typename DiagonalProxy< MT >::RepresentedType >::Type conj(const DiagonalProxy< MT > &proxy)
Computing the complex conjugate of the represented element.
Definition: DiagonalProxy.h:487
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
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
BLAZE_ALWAYS_INLINE void conjugate(T &a)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
Header file for the IsBuiltin type trait.
BLAZE_ALWAYS_INLINE void cswap(T &a, T &b)
Swapping two conjugated values/objects.
Definition: Conjugate.h:197
System settings for the inline keywords.