API reference — expression templates#
Every leaf and composite node in aether derives from Expression; the
individual node types (Sum, CWiseScale, Cross, QuatRotate,
…) live in aether::detail and are reached through the operators
documented in Expression templates, not cited individually here.
aether::eval is the dual-mode runtime evaluator that walks a tree at
assignment time.
aether::Expression#
-
template<class Derived, class T>
class Expression# CRTP base for every expression-template leaf/node. A tag base (
element_typealias only — no state) that anchors theaether_expressionconcept viastd::derived_from, plus the geometric/reduction/quaternion/slicing member-function surface described in the file docstring above. Adding members here does not change any already-derived type’s ABI (still an empty base — every new member is either state-free or template-only).Subclassed by aether::View< T, extents< dyn >, layout_right, false, true >, aether::View< T, Extents, Layout, Volatile, ReadOnly >, aether::detail::Sum< L, R, subtract >
Public Types
Public Functions
-
template<class E>
inline constexpr element_type dot(const Expression<E, typename E::element_type> &other) const# Dot product with another rank-1 expression of the same shape.
-
inline constexpr element_type squaredNorm() const#
Squared L2 norm — sum of squares of components.
-
inline constexpr working_type squaredNormWorking_() const#
Squared L2 norm left IN THE WORKING CARRIER - the shared body the four norm accessors below fold on top of, so a
norm()or arCubedNorm()pays ONE encode at its own return rather than one per intermediate. Internal (trailing underscore); the public spelling issquaredNorm()directly above.
-
inline constexpr element_type norm() const#
L2 norm.
-
inline constexpr element_type rNorm() const#
Reciprocal of the L2 norm (accurate division, not a fast rsqrt approximation).
-
inline constexpr element_type rSquaredNorm() const#
Reciprocal of the squared L2 norm.
-
inline constexpr element_type cubedNorm() const#
Cubed L2 norm (
‖v‖³).
-
inline constexpr element_type rCubedNorm() const#
Reciprocal of the cubed L2 norm (
1/‖v‖³).
-
inline constexpr element_type maxNorm() const#
L-infinity (max-abs) norm.
-
inline constexpr element_type sum() const#
Sum of all components.
-
template<class E>
inline constexpr auto cross(const Expression<E, typename E::element_type> &other) const# Cross product with another 3-vector expression; lazy (evaluate by assigning to a 3-shaped target).
-
inline constexpr auto unitVector() const#
Unit-vector (normalized) view of this expression; lazy.
-
template<class E>
inline constexpr auto quatMul(const Expression<E, typename E::element_type> &other) const# Quaternion (Hamilton) product
*this ⊗ other; lazy.
-
inline constexpr auto quatConj() const#
Quaternion conjugate (negate the vector part); lazy.
-
inline constexpr auto quatReciprocal() const#
Quaternion reciprocal (
q⁻¹ = q* / ‖q‖²); lazy, reusesquatConj()andrSquaredNorm().
-
template<class E>
inline constexpr auto quatRotate(const Expression<E, typename E::element_type> &vec) const# Rodrigues-formula rotation of 3-vector
vecby this unit quaternion; lazy.
-
inline constexpr auto asPureQuaternion() const#
View this 3-vector as a pure quaternion
[0,x,y,z]; lazy.
-
inline constexpr auto asBack3DVector() const#
View this quaternion’s vector part (drop the scalar, index 0); reuses
tail<3>.
-
template<std::size_t Off, std::size_t Len>
inline constexpr auto segment() const# Read-only view of
Lenconsecutive components starting atOff.
-
template<std::size_t N>
inline constexpr auto head() const# Read-only view of the first
Ncomponents.
-
template<std::size_t N>
inline constexpr auto tail() const# Read-only view of the last
Ncomponents.
-
inline constexpr auto transpose() const#
Read-only transpose of this rank-2 (matrix) expression; lazy.
-
template<std::size_t R>
inline constexpr auto row() const# Read-only view of row
Rof this rank-2 expression (a rank-1/vector expression); lazy.
-
template<std::size_t C>
inline constexpr auto col() const# Read-only view of column
Cof this rank-2 expression (a rank-1/vector expression); lazy.
-
template<std::size_t R0, std::size_t C0, std::size_t BR, std::size_t BC>
inline constexpr auto block() const# Read-only view of a
BR x BCblock starting at(R0, C0)of this rank-2 expression; lazy.
-
template<class E>
inline constexpr auto cwiseMul(const Expression<E, typename E::element_type> &other) const# Hadamard (component-wise) product with another expression of the same
element_extents; lazy.
-
template<class E>
inline constexpr element_type matDot(const Expression<E, typename E::element_type> &other) const# Frobenius inner product
sum_{r,c} this(r,c) * other(r,c)of two rank-2 expressions; evaluates eagerly (sample-free,SampleIndex::make(0), matchingdot()’s convention).
-
inline constexpr element_type trace() const#
Trace (sum of the diagonal) of a square 2x2 or 3x3 rank-2 expression.
-
inline constexpr element_type det() const#
Determinant of a square 2x2 or 3x3 rank-2 expression (closed-form cofactor expansion).
-
inline constexpr auto inverse() const#
Closed-form inverse of a square 2x2 or 3x3 rank-2 expression; lazy — each component is an INDEPENDENT recompute of the source expression’s components plus the determinant (matches
Cross’s own per-component recompute convention,aether/expr/nodes/Geometric.h’s docstring), so it is safe to assign into a batched destination (eacheval<R,C>(i)uses theiit is actually called with, unliketrace()/det()above).
-
template<class E>
Namespace aether::eval#
-
namespace eval#
Enums
Functions
-
inline void runtimeEval(RuntimeOp op, const RuntimeView &a, const RuntimeView &b, const RuntimeView &out, double scalar = 0.0)#
Elementwise runtime evaluator entry point — host-callable. Validates
a/b/out(shape + dtype) and throwsaether::Erroron mismatch BEFORE dispatching; the dispatch itself either runs on the host or launchesdetail::evalKernelonout.device.bis read only byAdd/Sub/AddScaled/SubScaled— pass a default-constructedRuntimeView{}for the unary ops (Assign/Scale).scalaris read only byScale/AddScaled/SubScaled(ignored, but harmless, otherwise).Assignis the ONE op allowed to seea.dtype != out.dtype(that is precisely what makes it also serve as adouble<->floatcast); every other op requires every operand it actually reads to shareout’s dtype.- Throws:
aether::Error – on a shape mismatch (
a/bvsout), an unsupported dtype (v1: onlydouble/float), adtypedisagreement not covered by theAssigncast allowance, or (viadetail::dispatch) a flat element count too large to address.
-
namespace detail#
Functions
-
template<class TIn, class TOut>
inline void evalElement(const RuntimeView &a, const RuntimeView &b, const RuntimeView &out, RuntimeOp op, TIn scalar, offset_t linear)# One element of the generic strided elementwise loop — THE device-legal core both drivers below call. Decomposes
linear(row-major overout.rank/out.extents) into a multi-index, addressesa/b/outthrough EACH OPERAND’S OWNstrides, and appliesop.b’s pointer/strides are simply never DEREFERENCED for the ops that do not use it (Assign/Scale) — callers pass a defaultRuntimeView{}forbthen (arithmetic on its strides is harmless: no read ofb.dataever happens on those paths).
-
inline std::size_t flatSizeWide(const RuntimeView &v)#
Product of
v.extents[0..v.rank)at FULLstd::size_twidth — mirrorsextents::extentWide()’s “the guard’s input stays wide” convention (aether/index/Offset.h). Host-only.
-
inline bool sameShape(const RuntimeView &x, const RuntimeView &y)#
-
template<class TIn, class TOut>
void dispatch(RuntimeOp op, const RuntimeView &a, const RuntimeView &b, const RuntimeView &out, double scalar)# Host entry point for one resolved
<TIn, TOut>pair: validates the flat element count against the addressable cap, then either launchesevalKernel(CUDA device targets) or runs the SAMEevalElementcore in a serial host loop.
Variables
-
template<class...>
constexpr bool device_compiler_v = (AETHER_DEVICE_COMPILER != 0)# AETHER_DEVICE_COMPILERas a DEPENDENT constant.static_assert(AETHER_DEVICE_COMPILER, ...)written directly in a template body is a NON-dependent condition: the compiler evaluates it while merely PARSING the template, so a host TU that only includes this header would be rejected. Routing the same constant through a variable template makes it dependent, so the diagnostic fires exactly when the launch path is INSTANTIATED — including aether from a host TU stays free.
-
template<class TIn, class TOut>
-
inline void runtimeEval(RuntimeOp op, const RuntimeView &a, const RuntimeView &b, const RuntimeView &out, double scalar = 0.0)#