E.V.E  0.1-beta
Semantic of EVE functions

EVE provides a lot of function that operates on similar premises. This page gather the general behaviors EVE functions can exhibit.

Operations Classification

Generalized Element Access

EVE functions' semantics rely on a generic way to access an element of a value in a generic way, be it scalar or SIMD.

To do so, we define a synthetic function at(v,i) that retrieve the ith element of a value v.

template<eve::value V, std::integral I> auto at(V const& v, I i)
{
if constexpr( eve::simd_value<V>) return v.get(i);
else return v;
}
Specifies that a type a SIMD type.
Definition: vectorized.hpp:32

Elementwise Operations

Elementwise operations in EVE describe functions that operates in a regular pattern over each and every element of its input and generates a return value with the same cardinal as its inputs.

For any values x1, ..., xn of types T1, ..., Tn, a Callable Object f returning a value of type R is said to be Elementwise if the expression R r = f(x1, ...,xn) is semantically equivalent to:

Note
No constraints are required on either the input or output types.

Reductions

Elementwise operations in EVE describe functions that operates over all elements of a given value to produce a single scalar result.

For any value x of type T, a Callable Object f returning a scalar value of type eve::elemet_type<T> is said to be a Reduction.

Function Semantic

Arithmetic Functions

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:

  • if C models eve::simd_value: C r = [](auto i, auto) { return f(at(C(x1),i), ..., at(C(xn),i)); }
  • if C models eve::scalar_value: C r = return f(C(x1), ..., C(xn))

In a less formal way, EVE Arithmetic Functions generalizes the notion of native C++ arithmetic operations.

Note
A large majority of Arithmetic Functions are de facto Elementwise Operations .

Bitwise Functions

For any values x1, ..., xn of types T1, ..., Tnso that the expression eve::bit_compatible_values<T1,...,Tn> evaluates to true, a Callable Object f is said to be a Bitwise Function if the expression T1 r = f(x1, ..., xn) is semantically equivalent to:

In a less formal way, EVE Bitwise Functions can be applied to any pair of types, the first acting as the value type and the second as a type-less source of bits.

Note
A large majority of Bitwise Functions are de facto Elementwise Operations .

Logical Functions

EVE Logical Functions are Arithmetic Functions that can only be applied to [logical values][eve::logical_value) L1,... Ln that verify that either eve::cardinal<L1>::value ==eve::cardinal<Ln>::value or that, for a given n, the expression std::same_as<eve::cardinal<Ln>,eve::scalar_cardinal> evaluates to true.

In a less formal way, EVE Logical Functions can be applied to set of logical values as long as they all share the same number of lanes, except for any potential logical scalar values.

Note
A large majority of Logical Functions are de facto Elementwise Operations .