Stratax 0.4.0rc1
Loading...
Searching...
No Matches
DTypeTraits.hpp File Reference

Compile-time metadata for supported dtypes. More...

#include <climits>
#include <cstddef>
#include <limits>
#include <string_view>
#include <type_traits>
#include <stratax/core/dtypes/Types.hpp>
Include dependency graph for DTypeTraits.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::bool_ >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::int8 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::int16 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::int32 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::int64 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::uint8 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::uint16 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::uint32 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::uint64 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::float32 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::float64 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::longdouble >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::complex64 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::complex128 >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::dtype_detail::DTypeTraitsImpl< dtype::clongdouble >
 Registered dtype metadata specialization. More...
 
struct  stratax::core::DTypeTraits< T >
 Provides compile-time metadata for a supported Stratax dtype. More...
 
struct  stratax::core::ComplexComponent< dtype::complex64 >
 Real component mapping for a registered complex dtype. More...
 
struct  stratax::core::ComplexComponent< dtype::complex128 >
 Real component mapping for a registered complex dtype. More...
 
struct  stratax::core::ComplexComponent< dtype::clongdouble >
 Real component mapping for a registered complex dtype. More...
 
struct  stratax::core::ComplexFromReal< dtype::float32 >
 Complex mapping for a registered real floating-point dtype. More...
 
struct  stratax::core::ComplexFromReal< dtype::float64 >
 Complex mapping for a registered real floating-point dtype. More...
 
struct  stratax::core::ComplexFromReal< dtype::longdouble >
 Complex mapping for a registered real floating-point dtype. More...
 

Macros

#define STRATAX_DEFINE_DTYPE_TRAITS(TYPE, KIND, NAME)
 Defines metadata for a non-complex Stratax dtype.
 
#define STRATAX_DEFINE_FLOAT_DTYPE_TRAITS(TYPE, RANK, NAME)
 Defines metadata for a ranked floating-point Stratax dtype.
 
#define STRATAX_DEFINE_COMPLEX_DTYPE_TRAITS(TYPE, COMPONENT, RANK, NAME)
 Defines metadata for a complex Stratax dtype.
 
#define STRATAX_DEFINE_COMPLEX_COMPONENT(COMPLEX, REAL)
 Defines a complex-to-real component specialization.
 
#define STRATAX_DEFINE_COMPLEX_FROM_REAL(REAL, COMPLEX)
 Defines a real-to-complex dtype specialization.
 

Typedefs

template<typename T >
using stratax::core::complex_component_t = typename ComplexComponent< std::remove_cvref_t< T > >::type
 Underlying real dtype of a complex dtype.
 
template<typename T >
using stratax::core::complex_from_real_t = typename ComplexFromReal< std::remove_cvref_t< T > >::type
 Complex dtype corresponding to a real floating-point dtype.
 

Enumerations

enum class  stratax::core::DTypeKind {
  Bool , SignedInteger , UnsignedInteger , Floating ,
  Complex
}
 Identifies the general category of a Stratax dtype. More...
 

Detailed Description

Compile-time metadata for supported dtypes.

Definition in file DTypeTraits.hpp.

Macro Definition Documentation

◆ STRATAX_DEFINE_COMPLEX_COMPONENT

#define STRATAX_DEFINE_COMPLEX_COMPONENT (   COMPLEX,
  REAL 
)
Value:
\
template<> \
struct ComplexComponent<COMPLEX> \
{ \
using type = REAL; \
}

Defines a complex-to-real component specialization.

Definition at line 135 of file DTypeTraits.hpp.

◆ STRATAX_DEFINE_COMPLEX_DTYPE_TRAITS

#define STRATAX_DEFINE_COMPLEX_DTYPE_TRAITS (   TYPE,
  COMPONENT,
  RANK,
  NAME 
)
Value:
\
template<> \
struct DTypeTraitsImpl<TYPE> \
{ \
using type = TYPE; \ using component_type = COMPONENT; \ static constexpr DTypeKind kind = DTypeKind::Complex; \ static constexpr std::size_t bits = sizeof(type) * CHAR_BIT; \ static constexpr int digits = std::numeric_limits<component_type>::digits; \ static constexpr std::size_t rank = RANK; \ static constexpr std::string_view name = NAME; \
}

Defines metadata for a complex Stratax dtype.

Complex precision is defined by the precision of its underlying floating-point component type.

Definition at line 76 of file DTypeTraits.hpp.

◆ STRATAX_DEFINE_COMPLEX_FROM_REAL

#define STRATAX_DEFINE_COMPLEX_FROM_REAL (   REAL,
  COMPLEX 
)
Value:
\
template<> \
struct ComplexFromReal<REAL> \
{ \
using type = COMPLEX; \
}

Defines a real-to-complex dtype specialization.

Definition at line 163 of file DTypeTraits.hpp.

◆ STRATAX_DEFINE_DTYPE_TRAITS

#define STRATAX_DEFINE_DTYPE_TRAITS (   TYPE,
  KIND,
  NAME 
)
Value:
\
template<> \
struct DTypeTraitsImpl<TYPE> \
{ \
using type = TYPE; \ static constexpr DTypeKind kind = DTypeKind::KIND; \ static constexpr std::size_t bits = sizeof(type) * CHAR_BIT; \ static constexpr int digits = std::numeric_limits<type>::digits; \ static constexpr std::string_view name = NAME; \
}

Defines metadata for a non-complex Stratax dtype.

Definition at line 42 of file DTypeTraits.hpp.

◆ STRATAX_DEFINE_FLOAT_DTYPE_TRAITS

#define STRATAX_DEFINE_FLOAT_DTYPE_TRAITS (   TYPE,
  RANK,
  NAME 
)
Value:
\
template<> \
struct DTypeTraitsImpl<TYPE> \
{ \
using type = TYPE; \ static constexpr DTypeKind kind = DTypeKind::Floating; \ static constexpr std::size_t bits = sizeof(type) * CHAR_BIT; \ static constexpr int digits = std::numeric_limits<type>::digits; \ static constexpr std::size_t rank = RANK; \ static constexpr std::string_view name = NAME; \
}

Defines metadata for a ranked floating-point Stratax dtype.

Definition at line 57 of file DTypeTraits.hpp.

Typedef Documentation

◆ complex_component_t

template<typename T >
using stratax::core::complex_component_t = typedef typename ComplexComponent<std::remove_cvref_t<T> >::type

Underlying real dtype of a complex dtype.

Definition at line 153 of file DTypeTraits.hpp.

◆ complex_from_real_t

template<typename T >
using stratax::core::complex_from_real_t = typedef typename ComplexFromReal<std::remove_cvref_t<T> >::type

Complex dtype corresponding to a real floating-point dtype.

Definition at line 181 of file DTypeTraits.hpp.

Enumeration Type Documentation

◆ DTypeKind

enum class stratax::core::DTypeKind
strong

Identifies the general category of a Stratax dtype.

Definition at line 19 of file DTypeTraits.hpp.