Blaze 3.9
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/EnableIf.h>
47
48
49namespace blaze {
50
51//=================================================================================================
52//
53// CONJ SHIM
54//
55//=================================================================================================
56
57//*************************************************************************************************
79template< typename T, EnableIf_t< IsNumeric_v<T> >* = nullptr >
80BLAZE_ALWAYS_INLINE constexpr T conj( const T& a ) noexcept
81{
82 return a;
83}
84//*************************************************************************************************
85
86
87
88
89//=================================================================================================
90//
91// CONJUGATE SHIM
92//
93//=================================================================================================
94
95//*************************************************************************************************
117template< typename T >
118BLAZE_ALWAYS_INLINE void conjugate( T& a ) noexcept( IsNumeric_v<T> )
119{
120 a = conj( a );
121}
122//*************************************************************************************************
123
124
125
126
127//=================================================================================================
128//
129// CSWAP SHIM
130//
131//=================================================================================================
132
133//*************************************************************************************************
142template< typename T, DisableIf_t< IsNumeric_v<T> >* = nullptr >
143BLAZE_ALWAYS_INLINE void cswap_backend( T& a, T& b )
144{
145 using std::swap;
146
147 swap( a, b );
148 conjugate( a );
149 conjugate( b );
150}
152//*************************************************************************************************
153
154
155//*************************************************************************************************
164template< typename T, EnableIf_t< IsNumeric_v<T> >* = nullptr >
165BLAZE_ALWAYS_INLINE void cswap_backend( T& a, T& b ) noexcept
166{
167 const T tmp( a );
168 a = conj( b );
169 b = conj( tmp );
170}
172//*************************************************************************************************
173
174
175//*************************************************************************************************
192template< typename T >
193BLAZE_ALWAYS_INLINE void cswap( T& a, T& b ) noexcept( IsNumeric_v<T> )
194{
195 cswap_backend( a, b );
196}
197//*************************************************************************************************
198
199} // namespace blaze
200
201#endif
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) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:225
BLAZE_ALWAYS_INLINE constexpr T conj(const T &a) noexcept
Computing the conjugate of the given numeric value.
Definition: Conjugate.h:80
BLAZE_ALWAYS_INLINE void cswap(T &a, T &b) noexcept(IsNumeric_v< T >)
Swapping two conjugated values/objects.
Definition: Conjugate.h:193
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric_v< T >)
In-place conjugation of the given value/object.
Definition: Conjugate.h:118
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
System settings for the inline keywords.