EVE provides a lot of function that operates on similar premises. This page gather the general behaviors EVE types and functions can exhibit.
For any value type, the cardinal is the number of elements it contains. This information is retrieved via the eve::cardinal type trait.
For any SIMD type T
, eve::cardinal<T>::type
evaluates to eve::fixed<N>
, where N
is the number of lanes of the underlying SIMD register.
Two types are said to be cardinal compatible if they have the same cardinal or at least one of them is a scalar type.
For any value type, its underlying element type is the type used to represent its internal values. This information is retrieved via the eve::element_type type trait.
T
, eve::element_type<T>::type
evaluates to T
.eve::wide<T,N>
, eve::element_type<eve::wide<T,N>>::type
evaluates to T
.eve::logical<T>
, eve::element_type<eve::logical<T>>::type
evaluates to eve::logical<T>
.SIMD type internals depend on the actual architecture and instruction set available. This information is retrieved via the eve::abi_of type trait.
EVE functions' semantics rely on a generic way to access an element of a value, be it scalar or SIMD.
To do so, we define a synthetic function get(v,i)
that retrieve the i
th element of a value v
.
For any values x1, ..., xn
of types T1, ..., Tn
, a Callable Object f
returning a value of type R
is said to be Element-wise if the expression R r = f(x1, ...,xn)
is semantically equivalent to:
R
models eve::simd_value : R
models eve::scalar_value : For any SIMD value x
of type T
, a Callable Object f
returning a scalar value of type R
is said to be a Reduction if the expression R r = f(x)
is semantically equivalent to:
Most reduction operations are not defined on scalar values unless their definition is required by the internal implementation.
For any values x1, ..., xn
of types T1, ..., Tn
so that the expression using C = eve::common_compatible_t<T1,...,Tn>
is valid, a Callable Object f
is said to be an Arithmetic Function if the expression C r = f(x1, ...,xn)
is semantically equivalent to:
C
models eve::simd_value: C
models eve::scalar_value: In a less formal way, EVE Arithmetic Functions generalizes the notion of native C++ arithmetic operations. By construction, a large majority of Arithmetic Functions are de facto Element-wise Operations.
EVE Bitwise Functions are Arithmetic Functions that are quite type agnostic as long as they are all size-compatible. By construction, all but bit_select Bitwise Functions are de facto_ Element-wise Operations and return a value in the (possibly vector extended) type of their first parameter.
EVE Logical Functions are Arithmetic Functions that can only be applied to logical values L1, ..., Ln
as long as they are all cardinal-compatible. By construction, a large majority of Logical Functions are de facto Element-wise Operations.
EVE constant generator are Callable Object that takes a single argument of type eve::as. This argument provides the information about the type used to generate the constant. E.g:
Some constants are exactly representable in IEEE754 types. However, some mathematical constants can be under-represented on a given type while simultaneously be over-represented on other. For example, \(\pi\) in float
is greater than its mathematical value. Meanwhile \(\pi\) in double
is less than its mathematical value.
The constant implementation is so that, for any constant generator g
:
g(eve::as<T>())
returns the nearest representable value of the mathematical constantg[eve::downward](eve::as<T>())
returns a value no lesser than 0.5 ULP from the mathematical constantg[eve::upward](eve::as<T>())
returns a value no greater than 0.5 ULP from the mathematical constantFor all constants,
g[eve::downward](eve::as<T>()) <= g(eve::as<T>()) <= g[eve::upward](eve::as<T>())
is always verified.
We encourage user facing issue with reproducible computation to use those decorators to make all constant generation stable across types.