Type Traits#

MatX type traits help advanced developers to make compile-time decisions about types. Most of these are used extensively inside of MatX, and are not needed in most user applications.

template<typename T>
using matx::promote_half_t = typename std::conditional_t<is_half_v<T> || is_matx_half_v<T>, float, T>#

Promote half precision floating point value to fp32, or leave untouched if not half.

Template Parameters:

T – Type to convert

template<class T>
struct remove_cvref#

Removes cv and reference qualifiers on a type.

Template Parameters:

T – Type to remove qualifiers

template<typename T>
__MATX_HOST__ __MATX_DEVICE__ constexpr bool matx::is_matx_op()#

Determine if a type is a MatX operator.

Template Parameters:

T – Type to test

template<typename T>
constexpr bool matx::is_executor_t()#

Determine if a type is a MatX executor.

Template Parameters:

T – Type to test

template<class T>
constexpr bool matx::is_tensor_view_v = detail::is_tensor_view<typename remove_cvref<T>::type>::value#

Determine if a type is a MatX tensor view type.

Template Parameters:

T – Type to test

template<typename T>
constexpr bool matx::is_matx_reduction_v = detail::is_matx_reduction_impl<T>::value#

Determine if a type is a MatX reduction.

Template Parameters:

T – Type to test

template<typename T>
constexpr bool matx::is_matx_index_reduction_v = detail::is_matx_idx_reduction_impl<T>::value#

Determine if a type is a MatX index reduction type.

Template Parameters:

T – Type to test

template<class T>
constexpr bool matx::is_cuda_complex_v = detail::is_cuda_complex<remove_cvref_t<T>>::value#

Determine if a type is a cuda::std::complex variant.

Template Parameters:

T – Type to test

template<class T>
constexpr bool matx::is_complex_v = detail::is_complex<remove_cvref_t<T>>::value#

Determine if a type is a complex type (any type supported)

Template Parameters:

T – Type to test

template<class T>
constexpr bool matx::is_complex_half_v = detail::is_complex_half<T>::value#

Determine if a type is a MatX half precision wrapper (either matxFp16 or matxBf16)

Template Parameters:

T – Type to test

template<typename T>
inline constexpr bool matx::IsHalfType()#

Tests if a type is a half precision floating point.

Template Parameters:

T – Type to test

Returns:

True if half precision floating point

template<class T>
constexpr bool matx::is_half_v = detail::is_half<T>::value#

Determine if a type is half precision (either __half or __nv_bfloat16)

Template Parameters:

T – Type to test

template<class T>
constexpr bool matx::is_matx_type_v = detail::is_matx_type<T>::value#

Determine if a type is a MatX custom type (half precision wrappers)

Template Parameters:

T – Type to test

template<typename T>
constexpr bool matx::is_matx_shape_v = detail::is_matx_shape<typename remove_cvref<T>::type>::value#

Determine if a type is a MatX shape type.

Template Parameters:

T – Type to test

template<typename T>
constexpr bool matx::is_matx_storage_v = detail::is_matx_storage<typename remove_cvref<T>::type>::value#

Determine if a type is a MatX storage type.

Template Parameters:

T – Type to test

template<typename T>
constexpr bool matx::is_matx_storage_container_v = detail::is_matx_storage_container<typename remove_cvref<T>::type>::value#

Determine if a type is a MatX storage container.

Template Parameters:

T – Type to test

template<typename T>
constexpr bool matx::is_matx_descriptor_v = detail::is_matx_descriptor<typename remove_cvref<T>::type>::value#

Determine if a type is a MatX descriptor.

Template Parameters:

T – Type to test