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

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

#include <TypeTraits.hpp>

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

Public Types

typedef T ValueType
 The scalar value type. More...
 
typedef T RealType
 The real-valued type (identical to ValueType for scalar traits). More...
 
typedef const T & ConstReference
 Constant-reference type to a value. More...
 
typedef ScalarTraits< T > SelfType
 Convenience alias for this traits instantiation. More...
 

Static Public Member Functions

static RealType real (ConstReference t)
 Returns the real part of t (identical to t for non-complex scalars). More...
 
static RealType imag (ConstReference)
 Returns the imaginary part (always zero for non-complex scalars). More...
 
static RealType conj (ConstReference t)
 Returns the complex conjugate of t (identical to t for non-complex scalars). More...
 
static RealType abs (ConstReference t)
 Returns the absolute value of t (std::abs for signed types, the identity for unsigned types). More...
 
static ValueType sqrt (ConstReference t)
 Returns the square root of t. More...
 
static RealType norm1 (ConstReference t)
 Returns the L1 norm of t (identical to the absolute value for scalar values). More...
 
static RealType norm2 (ConstReference t)
 Returns the L2 (Euclidean) norm of t (identical to the absolute value for scalar values). More...
 
static RealType normInf (ConstReference t)
 Returns the L∞ norm of t (identical to the absolute value for scalar values). More...
 

Detailed Description

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

Common operations and type aliases for scalar arithmetic types.

Template Parameters
TThe scalar value type.

Member Typedef Documentation

◆ ValueType

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

The scalar value type.

◆ RealType

template<typename T >
typedef T CDPL::Math::ScalarTraits< T >::RealType

The real-valued type (identical to ValueType for scalar traits).

◆ ConstReference

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

Constant-reference type to a value.

◆ SelfType

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

Convenience alias for this traits instantiation.

Member Function Documentation

◆ real()

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

Returns the real part of t (identical to t for non-complex scalars).

Parameters
tThe value.
Returns
The real part of t.

◆ imag()

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

Returns the imaginary part (always zero for non-complex scalars).

Returns
The default-constructed RealType.

◆ conj()

template<typename T >
static RealType CDPL::Math::ScalarTraits< T >::conj ( ConstReference  t)
inlinestatic

Returns the complex conjugate of t (identical to t for non-complex scalars).

Parameters
tThe value.
Returns
The conjugate of t.

◆ abs()

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

Returns the absolute value of t (std::abs for signed types, the identity for unsigned types).

Parameters
tThe value.
Returns
The absolute value of t.

◆ sqrt()

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

Returns the square root of t.

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

◆ norm1()

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

Returns the L1 norm of t (identical to the absolute value for scalar values).

Parameters
tThe value.
Returns
The L1 norm of t.

◆ norm2()

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

Returns the L2 (Euclidean) norm of t (identical to the absolute value for scalar values).

Parameters
tThe value.
Returns
The L2 norm of t.

◆ normInf()

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

Returns the L∞ norm of t (identical to the absolute value for scalar values).

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

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