Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Static Public Member Functions | List of all members
CDPL::Math::ComplexTraits< T > Struct Template Reference

Common operations and type aliases for complex arithmetic types. More...

#include <TypeTraits.hpp>

+ Inheritance diagram for CDPL::Math::ComplexTraits< T >:

Public Types

typedef T ValueType
 The complex value type (a std::complex specialization). More...
 
typedef T::value_type RealType
 The underlying real-valued type. More...
 
typedef const T & ConstReference
 Constant-reference type to a value. More...
 
typedef ComplexTraits< T > SelfType
 Convenience alias for this traits instantiation. More...
 

Static Public Member Functions

static RealType real (ConstReference t)
 Returns the real part of the complex value t. More...
 
static RealType imag (ConstReference t)
 Returns the imaginary part of the complex value t. More...
 
static ValueType conj (ConstReference t)
 Returns the complex conjugate of t. More...
 
static RealType abs (ConstReference t)
 Returns the modulus (absolute value) of the complex value t. More...
 
static ValueType sqrt (ConstReference t)
 Returns the principal complex square root of t. More...
 
static RealType norm1 (ConstReference t)
 Returns the L1 norm of the complex value t ( \( |\mathrm{Re}(t)| + |\mathrm{Im}(t)| \)). More...
 
static RealType norm2 (ConstReference t)
 Returns the L2 norm of the complex value t (identical to its modulus). More...
 
static RealType normInf (ConstReference t)
 Returns the L∞ norm of the complex value t ( \( \max(|\mathrm{Re}(t)|, |\mathrm{Im}(t)|) \)). More...
 

Detailed Description

template<typename T>
struct CDPL::Math::ComplexTraits< T >

Common operations and type aliases for complex arithmetic types.

Template Parameters
TA std::complex specialization.

Member Typedef Documentation

◆ ValueType

template<typename T >
typedef T CDPL::Math::ComplexTraits< T >::ValueType

The complex value type (a std::complex specialization).

◆ RealType

template<typename T >
typedef T::value_type CDPL::Math::ComplexTraits< T >::RealType

The underlying real-valued type.

◆ ConstReference

template<typename T >
typedef const T& CDPL::Math::ComplexTraits< T >::ConstReference

Constant-reference type to a value.

◆ SelfType

template<typename T >
typedef ComplexTraits<T> CDPL::Math::ComplexTraits< T >::SelfType

Convenience alias for this traits instantiation.

Member Function Documentation

◆ real()

template<typename T >
static RealType CDPL::Math::ComplexTraits< T >::real ( ConstReference  t)
inlinestatic

Returns the real part of the complex value t.

Parameters
tThe complex value.
Returns
The real part \( \mathrm{Re}(t) \).

◆ imag()

template<typename T >
static RealType CDPL::Math::ComplexTraits< T >::imag ( ConstReference  t)
inlinestatic

Returns the imaginary part of the complex value t.

Parameters
tThe complex value.
Returns
The imaginary part \( \mathrm{Im}(t) \).

◆ conj()

template<typename T >
static ValueType CDPL::Math::ComplexTraits< T >::conj ( ConstReference  t)
inlinestatic

Returns the complex conjugate of t.

Parameters
tThe complex value.
Returns
The conjugate \( \overline{t} \).

◆ abs()

template<typename T >
static RealType CDPL::Math::ComplexTraits< T >::abs ( ConstReference  t)
inlinestatic

Returns the modulus (absolute value) of the complex value t.

Parameters
tThe complex value.
Returns
The modulus \( |t| \).

◆ sqrt()

template<typename T >
static ValueType CDPL::Math::ComplexTraits< T >::sqrt ( ConstReference  t)
inlinestatic

Returns the principal complex square root of t.

Parameters
tThe complex value.
Returns
\( \sqrt{t} \) as a complex value.

◆ norm1()

template<typename T >
static RealType CDPL::Math::ComplexTraits< T >::norm1 ( ConstReference  t)
inlinestatic

Returns the L1 norm of the complex value t ( \( |\mathrm{Re}(t)| + |\mathrm{Im}(t)| \)).

Parameters
tThe complex value.
Returns
The L1 norm of t.

◆ norm2()

template<typename T >
static RealType CDPL::Math::ComplexTraits< T >::norm2 ( ConstReference  t)
inlinestatic

Returns the L2 norm of the complex value t (identical to its modulus).

Parameters
tThe complex value.
Returns
The L2 norm of t.

◆ normInf()

template<typename T >
static RealType CDPL::Math::ComplexTraits< T >::normInf ( ConstReference  t)
inlinestatic

Returns the L∞ norm of the complex value t ( \( \max(|\mathrm{Re}(t)|, |\mathrm{Im}(t)|) \)).

Parameters
tThe complex value.
Returns
The L∞ norm of t.

The documentation for this struct was generated from the following file: