37 static inline E
from_complex (
const std::complex<T>& value)
38 {
return value.real(); }
41 static inline double to_real (
const E& element)
45 static inline E
conjugate (
const E& element)
56 static inline std::complex<E>
from_complex (
const std::complex<T>& value)
60 static inline double to_real (
const std::complex<E>& element)
61 {
return element.real(); }
65 static inline std::complex<E>
conjugate (
const std::complex<T>& value)
66 {
return std::conj(value); }
70template<
class T,
class E = ElementTraits<T> >
struct DatumTraits
78 static inline unsigned ndim () {
return 1; }
79 static inline T& element (T& t,
unsigned idim) {
return t; }
80 static inline const T& element (
const T& t,
unsigned idim) {
return t; }
90 static inline unsigned ndim () {
return 2; }
91 static inline T& element (std::complex<T>& t,
unsigned idim)
92 {
return reinterpret_cast<T*
>(&t)[idim]; }
94 static inline const T& element (
const std::complex<T>& t,
unsigned idim)
95 {
return reinterpret_cast<const T*
>(&t)[idim]; }
101std::complex<T> ci (
const std::complex<T>& c)
103 return std::complex<T> (-c.imag(), c.real());
108std::complex<T> ci (
const T& real)
110 return std::complex<T> (0.0, real);
119typename ElementTraits<T>::real
E element_traits
Definition Traits.h:73
static double to_real(const E &element)
static E conjugate(const E &element)
static E from_complex(const std::complex< T > &value)