Stratax 0.4.0rc1
Loading...
Searching...
No Matches
Dtypes and Promotion

Dtypes and Promotion

Headers: include/stratax/core/dtypes/Types.hpp, DTypeTraits.hpp, and Promotion.hpp; owning container result rules are in core/ArrayTraits.hpp.

Scalar aliases

Namespace Names C++ types
stratax::core index_t, ssize_t size_t, ptrdiff_t
stratax::dtype bool_ bool
stratax::dtype int8, int16, int32, int64 Corresponding fixed-width signed integers
stratax::dtype uint8, uint16, uint32, uint64 Corresponding fixed-width unsigned integers
stratax::dtype float32, float64, longdouble float, double, long double
stratax::dtype complex64, complex128, clongdouble std::complex of those real types

There are no float128 or complex256 aliases. Floating-point names map to native C++ representations; long double precision is platform-dependent.

Metadata and result traits

stratax::core::DTypeTraits<T> removes cv/ref qualifiers and exposes type, kind, storage bits, precision digits, and name. Floating/complex types also have a promotion rank; complex metadata includes component_type. Storage bits may include padding. ComplexComponent and ComplexFromReal map between registered complex and real component dtypes.

promote_t<L, R> selects the result dtype through Promote specializations. Refer to the generated Promotion.hpp reference for category-specific rules; this is distinct from C++'s intermediate expression type. Allocating operations usually compute using original scalar types then convert the result. rebind_array_t<A, T> changes the dtype of an owning family; promote_array_t<L, R, T> retains matching families and chooses Tensor for mixed families. ArrayView has no supplied owning result specialization.

#include <stratax.h>
#include <type_traits>
static_assert(std::is_same_v<float64, double>);
static_assert(std::is_same_v<stratax::core::promote_t<stratax::dtype::int16,
int main() {
float64 value = 3.5;
index_t count = 4;
(void)value;
(void)count;
}
typename Promote< std::remove_cvref_t< L >, std::remove_cvref_t< R > >::type promote_t
Convenience alias for the promoted dtype of two types.
std::int32_t int32
Signed 32-bit integer dtype.
Definition Types.hpp:31
double float64
Native double dtype.
Definition Types.hpp:47
std::int16_t int16
Signed 16-bit integer dtype.
Definition Types.hpp:29
std::size_t index_t
Unsigned size and index type.
Definition Types.hpp:14
Umbrella header for the Stratax array library.

All aliases and traits are compile-time constructs. They do not add checked casts, overflow detection, or runtime dtype dispatch. See DType and Array Concepts.