|
|
constexpr | UnitVector () |
| | Default constructor. Initializes all elements to zero.
|
| constexpr | UnitVector (const StorageType &d) |
| | Construct from a raw Eigen matrix.
|
| constexpr | UnitVector (StorageType &&d) |
| | Construct from a raw Eigen matrix (move).
|
|
constexpr | UnitVector (const UnitVector &)=default |
| | Copy constructor.
|
|
constexpr | UnitVector (UnitVector &&)=default |
| | Move constructor.
|
|
constexpr UnitVector & | operator= (const UnitVector &)=default |
| | Copy assignment.
|
|
constexpr UnitVector & | operator= (UnitVector &&)=default |
| | Move assignment.
|
| constexpr | UnitVector (units::unit_t< UnitTags >... args) |
| | Construct from individual unit values. Values are automatically converted to the units specified by UnitTags.
|
| constexpr const StorageType & | Raw () const |
| | Get a constant reference to the underlying raw Eigen data.
|
| constexpr StorageType & | Raw () |
| | Get a reference to the underlying raw Eigen data.
|
template<std::size_t N>
requires ValidIndex<N, UnitTags...> |
| constexpr auto | Get () const |
| | Get the value of the N-th element with its unit.
|
template<std::size_t N>
requires ValidIndex<N, UnitTags...> |
| void | Set (units::unit_t< std::tuple_element_t< N, UnitTuple > > val) |
| | Set the value of the N-th element.
|
template<typename T = std::tuple_element_t<0, UnitTuple>>
requires AllSameUnits<UnitTags...> |
| auto | Norm () const |
| | Computes the L2 norm (magnitude). Requires all elements to have the same unit tag.
|
| auto | Normalized () const |
| | Returns a normalized (unit-length) vector. Result is dimensionless. Only valid if all elements have the same unit.
|
template<typename... OtherTags>
requires (sizeof...(UnitTags) == sizeof...(OtherTags)) && AllSameUnits<MultiplyResult<UnitTags, OtherTags>...> |
| auto | Dot (const UnitVector< OtherTags... > &other) const |
| | Dot product with another UnitVector. Resulting unit is the product of the first tags of both vectors.
|
template<std::size_t N>
requires ValidSize<N, UnitTags...> |
| constexpr auto | Head () const |
| | Extract the first N elements as a new UnitVector.
|
template<std::size_t N>
requires ValidSize<N, UnitTags...> |
| constexpr auto | Tail () const |
| | Extract the last N elements as a new UnitVector.
|
template<std::size_t Start, std::size_t N>
requires ValidSize<Start + N, UnitTags...> |
| constexpr auto | Slice () const |
| | Extract N elements after the Start as a new UnitVector.
|
template<typename... OtherTags>
requires UnitEquality<UnitTuple, std::tuple<OtherTags...>> |
| constexpr UnitVector | operator+ (const UnitVector< OtherTags... > &other) const |
| | Vector addition.
|
template<typename... OtherTags>
requires UnitEquality<UnitTuple, std::tuple<OtherTags...>> |
| constexpr UnitVector | operator- (const UnitVector< OtherTags... > &other) const |
| | Vector subtraction.
|
|
constexpr UnitVector | operator- () const |
| | Unary negation.
|
template<typename... OtherTags>
requires UnitEquality<UnitTuple, std::tuple<OtherTags...>> |
| constexpr UnitVector & | operator+= (const UnitVector< OtherTags... > &other) |
| | In-place vector addition.
|
template<typename... OtherTags>
requires UnitEquality<UnitTuple, std::tuple<OtherTags...>> |
| constexpr UnitVector & | operator-= (const UnitVector< OtherTags... > &other) |
| | In-place vector subtraction.
|
| template<typename ScalarTag> |
| constexpr auto | operator* (const units::unit_t< ScalarTag > &scalar) const |
| | Multiplication by a scalar unit.
|
| template<typename ScalarTag> |
| constexpr auto | operator/ (const units::unit_t< ScalarTag > &scalar) const |
| | Division by a scalar unit.
|
| constexpr UnitVector | operator* (double scalar) const |
| | Raw scaling (multiplication by double).
|
| constexpr UnitVector | operator/ (double scalar) const |
| | Raw scaling (division by double).
|
template<typename... OtherTags>
requires UnitEquality<UnitTuple, std::tuple<OtherTags...>> |
| bool | operator== (const UnitVector< OtherTags... > &other) const |
| | Equality operator.
|
| template<typename... OtherTags> |
| constexpr auto | CWiseProduct (const UnitVector< OtherTags... > &other) const |
| | Component-wise product with another UnitVector.
|
| template<typename... OtherTags> |
| constexpr auto | CWiseQuotient (const UnitVector< OtherTags... > &other) const |
| | Component-wise quotient with another UnitVector.
|
|
constexpr UnitVector | CWiseAbs () const |
| | Component-wise absolute value.
|
|
constexpr UnitVector | CWiseMin (const UnitVector &other) const |
| | Component-wise minimum.
|
|
constexpr UnitVector | CWiseMax (const UnitVector &other) const |
| | Component-wise maximum.
|
| constexpr UnitVector | Clamp (const UnitVector &lo, const UnitVector &hi) const |
| | Clamp each element between lo and hi vectors.
|
| constexpr UnitVector | Clamp (units::unit_t< std::tuple_element_t< 0, UnitTuple > > lo, units::unit_t< std::tuple_element_t< 0, UnitTuple > > hi) const |
| | Clamp each element between lo and hi unit values.
|
| bool | IsApprox (const UnitVector &other, units::unit_t< std::tuple_element_t< 0, UnitTuple > > tol=units::unit_t< std::tuple_element_t< 0, UnitTuple > >{1e-9}) const |
| | Check if two vectors are approximately equal.
|
template<typename T = std::tuple_element_t<0, UnitTuple>>
requires AllSameUnits<UnitTags...> |
| auto | Sum () const |
| | Computes the sum of all elements. Only valid if all units are the same.
|
template<typename T = std::tuple_element_t<0, UnitTuple>>
requires AllSameUnits<UnitTags...> |
| auto | Mean () const |
| | Computes the mean of all elements. Only valid if all units are the same.
|
|
constexpr auto | X () const |
| | Access the first element (x).
|
|
void | X (units::unit_t< std::tuple_element_t< Size >=1 ? 0 :0, UnitTuple > > val) |
| | Set the first element (x).
|
|
constexpr auto | Y () const |
| | Access the second element (y).
|
|
void | Y (units::unit_t< std::tuple_element_t< Size >=2 ? 1 :0, UnitTuple > > val) |
| | Set the second element (y).
|
|
constexpr auto | Z () const |
| | Access the third element (z).
|
|
void | Z (units::unit_t< std::tuple_element_t< Size >=3 ? 2 :0, UnitTuple > > val) |
| | Set the third element (z).
|
|
constexpr auto | W () const |
| | Access the fourth element (w).
|
|
void | W (units::unit_t< std::tuple_element_t< Size >=4 ? 3 :0, UnitTuple > > val) |
| | Set the fourth element (w).
|
| auto | AsDiagonal () const |
| | Converts the vector to a diagonal matrix.
|
template<typename ScalarTag>
requires AllSameUnits<UnitTags...> && UnitEquality<ScalarTag, std::tuple_element_t<0, UnitTuple>> |
| constexpr UnitVector | operator+ (const units::unit_t< ScalarTag > &scalar) const |
| | Vector + scalar addition (broadcasting).
|
template<typename ScalarTag>
requires AllSameUnits<UnitTags...> && UnitEquality<ScalarTag, std::tuple_element_t<0, UnitTuple>> |
| constexpr UnitVector | operator- (const units::unit_t< ScalarTag > &scalar) const |
| | Vector - scalar subtraction (broadcasting).
|
template<typename ScalarTag>
requires AllSameUnits<UnitTags...> && UnitEquality<ScalarTag, std::tuple_element_t<0, UnitTuple>> |
| constexpr UnitVector & | operator+= (const units::unit_t< ScalarTag > &scalar) |
| | In-place vector + scalar addition (broadcasting).
|
template<typename ScalarTag>
requires AllSameUnits<UnitTags...> && UnitEquality<ScalarTag, std::tuple_element_t<0, UnitTuple>> |
| constexpr UnitVector & | operator-= (const units::unit_t< ScalarTag > &scalar) |
| | In-place vector - scalar subtraction (broadcasting).
|
template<int P, typename T = std::tuple_element_t<0, UnitTuple>>
requires AllSameUnits<UnitTags...> |
| auto | LPNorm () const |
| | Computes the Lp norm.
|
template<typename T = std::tuple_element_t<0, UnitTuple>>
requires AllSameUnits<UnitTags...> |
| auto | StableNorm () const |
| | Computes the stable norm.
|
|
constexpr auto | Begin () |
|
constexpr auto | End () |
|
constexpr auto | Begin () const |
|
constexpr auto | End () const |
template<typename... UnitTags>
class valor::EigenUnit::UnitVector< UnitTags >
A vector wrapper that enforces units for each element.
Each element in the vector can have a different unit tag. Operations between UnitVectors are only permitted if their tag packs match exactly.
- Template Parameters
-
| UnitTags | The unit types for each element in the vector. |