|
dot-xx
A personal collection of small C++ modules
|
Linear algebra utilities for dxx::math. More...
Concepts | |
| concept | dxx::math::container_traits::constructible |
| Checks if the library knows how to construct a vector container from a runtime size value. | |
| concept | dxx::math::container_traits::returnable |
| Checks if the library knows how to use a vector container type as a return value from procedures. | |
| concept | dxx::math::vector |
| We can treat any input range as a vector. | |
| concept | dxx::math::mut_vector |
| A vector for which the elements can be written to. | |
| concept | dxx::math::vector_like |
| Vector for which the element type is convertible to a target vector's type. | |
| concept | dxx::math::mut_vector_like |
| Similar to vector_like, but also satisfies mut_vector. | |
Classes | |
| struct | dxx::math::container_traits::size::Dynamic |
| Size is a runtime value during construction and can be changed. More... | |
| struct | dxx::math::container_traits::size::RuntimeFixed |
| Size can't be changed but unknown at compile time. More... | |
| struct | dxx::math::container_traits::size::Bound |
| Size is a runtime value during construction and can be changed, but limited by a compile-time constant. More... | |
| struct | dxx::math::container_traits::size::Static |
| Size is a compile-time constant and cannot be modified. More... | |
| struct | dxx::math::Norm< Func, SqFunc > |
| Defines a norm. Only norm field is required, all other fields can be assigned a nullptr. More... | |
Typedefs | |
| template<typename T> | |
| using | dxx::math::RealOf = detail::RealOf<T>::Type |
| (Non-cv-qualified) Real type of the linalg type | |
Functions | |
| template<mut_vector Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr void | dxx::math::add (U &&u, V &&v, Out &out) |
| Element-wise vector addition. Result via output parameter. | |
| template<container_traits::returnable Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr Out | dxx::math::add (U &&u, V &&v) |
| Element-wise vector addition. Result in return value of a user-provided type. | |
|
template<vector U, vector_like< U > V> requires container_traits::returnable<std::remove_cvref_t<U>> | |
| constexpr std::remove_cvref_t< U > | dxx::math::add (U &&u, V &&v) |
| Element-wise vector addition. Result in return value of automatically selected type. | |
|
template<vector U, vector_like< U > V> requires container_traits::returnable<std::remove_cvref_t<U>> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator+ (U &&u, V &&v) |
| Operator for a corrsponding add overload. | |
| template<mut_vector U, vector_like< U > V> | |
| constexpr U & | dxx::math::vector_operators::operator+= (U &u, const V &v) |
| Inplace element-wise vector addition. | |
| template<mut_vector Out, vector_like< Out > U, std::convertible_to< RealOf< Out > > Scalar> | |
| constexpr void | dxx::math::add (U &&u, const Scalar &scalar, Out &out) |
| Element-wise addition of vector elements with a scalar. Result via output parameter. | |
| template<container_traits::returnable Out, vector_like< Out > U, std::convertible_to< RealOf< Out > > Scalar> | |
| constexpr Out | dxx::math::add (U &&u, const Scalar &scalar) |
| Element-wise addition of vector elements with a scalar. Result in return value of a user-provided type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::add (U &&u, const Scalar &scalar) |
| Element-wise addition of vector elements with a scalar. Result in return value of automatically selected type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator+ (U &&u, const Scalar &scalar) |
| Operator for a corrsponding add overload. | |
| template<mut_vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr U & | dxx::math::vector_operators::operator+= (U &u, const Scalar &scalar) |
| Inplace element-wise addition of vector with scalar. | |
| template<mut_vector Out, std::convertible_to< RealOf< Out > > Scalar, vector_like< Out > U> | |
| constexpr void | dxx::math::add (const Scalar &scalar, U &&u, Out &out) |
| Element-wise addition of scalar with vector elements. Result via output parameter. | |
| template<container_traits::returnable Out, std::convertible_to< RealOf< Out > > Scalar, vector_like< Out > U> | |
| constexpr Out | dxx::math::add (const Scalar &scalar, U &&u) |
| Element-wise addition of scalar with vector elements. Result in return value of a user-provided type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::add (const Scalar &scalar, U &&u) |
| Element-wise addition of vector elements with a scalar. Result in return value of automatically selected type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator+ (const Scalar &scalar, U &&u) |
| Operator for a corrsponding add overload. | |
| template<mut_vector Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr void | dxx::math::sub (U &&u, V &&v, Out &out) |
| Element-wise vector subtraction. Result via output parameter. | |
| template<container_traits::returnable Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr Out | dxx::math::sub (U &&u, V &&v) |
| Element-wise vector subtraction. Result in return value of a user-provided type. | |
|
template<vector U, vector_like< U > V> requires container_traits::returnable<std::remove_cvref_t<U>> | |
| constexpr std::remove_cvref_t< U > | dxx::math::sub (U &&u, V &&v) |
| Element-wise vector subtraction. Result in return value of automatically selected type. | |
|
template<vector U, vector_like< U > V> requires container_traits::returnable<std::remove_cvref_t<U>> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator- (U &&u, V &&v) |
| Operator for a corrsponding sub overload. | |
| template<mut_vector U, vector_like< U > V> | |
| constexpr U & | dxx::math::vector_operators::operator-= (U &u, const V &v) |
| Inplace element-wise vector subtraction. | |
| template<mut_vector Out, vector_like< Out > U, std::convertible_to< RealOf< Out > > Scalar> | |
| constexpr void | dxx::math::sub (U &&u, const Scalar &scalar, Out &out) |
| Element-wise subtraction of vector elements with a scalar. Result via output parameter. | |
| template<container_traits::returnable Out, vector_like< Out > U, std::convertible_to< RealOf< Out > > Scalar> | |
| constexpr Out | dxx::math::sub (U &&u, const Scalar &scalar) |
| Element-wise subtraction of vector elements with a scalar. Result in return value of a user-provided type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::sub (U &&u, const Scalar &scalar) |
| Element-wise subtraction of vector elements with a scalar. Result in return value of automatically selected type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator- (U &&u, const Scalar &scalar) |
| Operator for a corrsponding sub overload. | |
| template<mut_vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr U & | dxx::math::vector_operators::operator-= (U &u, const Scalar &scalar) |
| Inplace element-wise subtraction of vector with scalar. | |
| template<mut_vector Out, std::convertible_to< RealOf< Out > > Scalar, vector_like< Out > U> | |
| constexpr void | dxx::math::sub (const Scalar &scalar, U &&u, Out &out) |
| Element-wise subtraction of scalar with vector elements. Result via output parameter. | |
| template<container_traits::returnable Out, std::convertible_to< RealOf< Out > > Scalar, vector_like< Out > U> | |
| constexpr Out | dxx::math::sub (const Scalar &scalar, U &&u) |
| Element-wise subtraction of scalar with vector elements. Result in return value of a user-provided type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::sub (const Scalar &scalar, U &&u) |
| Element-wise subtraction of vector elements with a scalar. Result in return value of automatically selected type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator- (const Scalar &scalar, U &&u) |
| Operator for a corrsponding sub overload. | |
| template<mut_vector Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr void | dxx::math::mul (U &&u, V &&v, Out &out) |
| Element-wise vector multiplication. Result via output parameter. | |
| template<container_traits::returnable Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr Out | dxx::math::mul (U &&u, V &&v) |
| Element-wise vector multiplication. Result in return value of a user-provided type. | |
|
template<vector U, vector_like< U > V> requires container_traits::returnable<std::remove_cvref_t<U>> | |
| constexpr std::remove_cvref_t< U > | dxx::math::mul (U &&u, V &&v) |
| Element-wise vector multiplication. Result in return value of automatically selected type. | |
|
template<vector U, vector_like< U > V> requires container_traits::returnable<std::remove_cvref_t<U>> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator* (U &&u, V &&v) |
| Operator for a corrsponding mul overload. | |
| template<mut_vector U, vector_like< U > V> | |
| constexpr U & | dxx::math::vector_operators::operator*= (U &u, const V &v) |
| Inplace element-wise vector multiplication. | |
| template<mut_vector Out, vector_like< Out > U, std::convertible_to< RealOf< Out > > Scalar> | |
| constexpr void | dxx::math::mul (U &&u, const Scalar &scalar, Out &out) |
| Element-wise multiplication of vector elements with a scalar. Result via output parameter. | |
| template<container_traits::returnable Out, vector_like< Out > U, std::convertible_to< RealOf< Out > > Scalar> | |
| constexpr Out | dxx::math::mul (U &&u, const Scalar &scalar) |
| Element-wise multiplication of vector elements with a scalar. Result in return value of a user-provided type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::mul (U &&u, const Scalar &scalar) |
| Element-wise multiplication of vector elements with a scalar. Result in return value of automatically selected type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator* (U &&u, const Scalar &scalar) |
| Operator for a corrsponding mul overload. | |
| template<mut_vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr U & | dxx::math::vector_operators::operator*= (U &u, const Scalar &scalar) |
| Inplace element-wise multiplication of vector with scalar. | |
| template<mut_vector Out, std::convertible_to< RealOf< Out > > Scalar, vector_like< Out > U> | |
| constexpr void | dxx::math::mul (const Scalar &scalar, U &&u, Out &out) |
| Element-wise multiplication of scalar with vector elements. Result via output parameter. | |
| template<container_traits::returnable Out, std::convertible_to< RealOf< Out > > Scalar, vector_like< Out > U> | |
| constexpr Out | dxx::math::mul (const Scalar &scalar, U &&u) |
| Element-wise multiplication of scalar with vector elements. Result in return value of a user-provided type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::mul (const Scalar &scalar, U &&u) |
| Element-wise multiplication of vector elements with a scalar. Result in return value of automatically selected type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator* (const Scalar &scalar, U &&u) |
| Operator for a corrsponding mul overload. | |
| template<mut_vector Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr void | dxx::math::div (U &&u, V &&v, Out &out) |
| Element-wise vector division. Result via output parameter. | |
| template<container_traits::returnable Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr Out | dxx::math::div (U &&u, V &&v) |
| Element-wise vector division. Result in return value of a user-provided type. | |
|
template<vector U, vector_like< U > V> requires container_traits::returnable<std::remove_cvref_t<U>> | |
| constexpr std::remove_cvref_t< U > | dxx::math::div (U &&u, V &&v) |
| Element-wise vector division. Result in return value of automatically selected type. | |
|
template<vector U, vector_like< U > V> requires container_traits::returnable<std::remove_cvref_t<U>> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator/ (U &&u, V &&v) |
| Operator for a corrsponding div overload. | |
| template<mut_vector U, vector_like< U > V> | |
| constexpr U & | dxx::math::vector_operators::operator/= (U &u, const V &v) |
| Inplace element-wise vector division. | |
| template<mut_vector Out, vector_like< Out > U, std::convertible_to< RealOf< Out > > Scalar> | |
| constexpr void | dxx::math::div (U &&u, const Scalar &scalar, Out &out) |
| Element-wise division of vector elements with a scalar. Result via output parameter. | |
| template<container_traits::returnable Out, vector_like< Out > U, std::convertible_to< RealOf< Out > > Scalar> | |
| constexpr Out | dxx::math::div (U &&u, const Scalar &scalar) |
| Element-wise division of vector elements with a scalar. Result in return value of a user-provided type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::div (U &&u, const Scalar &scalar) |
| Element-wise division of vector elements with a scalar. Result in return value of automatically selected type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator/ (U &&u, const Scalar &scalar) |
| Operator for a corrsponding div overload. | |
| template<mut_vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr U & | dxx::math::vector_operators::operator/= (U &u, const Scalar &scalar) |
| Inplace element-wise division of vector with scalar. | |
| template<mut_vector Out, std::convertible_to< RealOf< Out > > Scalar, vector_like< Out > U> | |
| constexpr void | dxx::math::div (const Scalar &scalar, U &&u, Out &out) |
| Element-wise division of scalar with vector elements. Result via output parameter. | |
| template<container_traits::returnable Out, std::convertible_to< RealOf< Out > > Scalar, vector_like< Out > U> | |
| constexpr Out | dxx::math::div (const Scalar &scalar, U &&u) |
| Element-wise division of scalar with vector elements. Result in return value of a user-provided type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::div (const Scalar &scalar, U &&u) |
| Element-wise division of vector elements with a scalar. Result in return value of automatically selected type. | |
| template<vector U, std::convertible_to< RealOf< U > > Scalar> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator/ (const Scalar &scalar, U &&u) |
| Operator for a corrsponding div overload. | |
| template<vector U> | |
| constexpr std::remove_cvref_t< U > | dxx::math::vector_operators::operator- (U &&u) |
| Unary negation for vectors. | |
| template<mut_vector Out, vector_like< Out > U, vector_like< Out > V> | |
| void | dxx::math::cross (const U &u, const V &v, Out &out) |
| Cross product of two 3D vectors (via out parameter). | |
| template<container_traits::returnable Out, vector_like< Out > U, vector_like< Out > V> | |
| constexpr Out | dxx::math::cross (const U &u, const V &v) |
| Cross product of two 3D vectors (via return value). | |
| template<container_traits::returnable U, vector_like< U > V> | |
| constexpr U | dxx::math::cross (const U &u, const V &v) |
| Cross product of two 3D vectors (via return value of default type). | |
| template<vector U, vector_like< U > V> | |
| constexpr RealOf< U > | dxx::math::dot (const U &u, const V &v) |
| Vector dot product. | |
| template<Norm t_norm = norms::euclidean, vector V> | |
| constexpr RealOf< V > | dxx::math::norm (const V &v) |
| Calculates norm t_norm for vector v. | |
| template<Norm t_norm = norms::euclidean, vector V> | |
| constexpr RealOf< V > | dxx::math::sq_norm (const V &v) |
| Calculates the square of the norm t_norm for vector v. | |
| template<Norm t_norm = norms::euclidean, vector V, vector_like< V > U> | |
| constexpr RealOf< V > | dxx::math::dist (const V &v, const U &u) |
| Calculates the distance between vector v and u according to norm t_norm. | |
| template<Norm t_norm = norms::euclidean, vector V, vector_like< V > U> | |
| constexpr RealOf< V > | dxx::math::sq_dist (const V &v, const U &u) |
| Calculates the square of the distance between vector v and u according to norm t_norm. | |
Variables | |
| constexpr Norm | dxx::math::norms::euclidean |
| Euclidean norm (2-norm). | |
| constexpr Norm | dxx::math::norms::p_one |
| 1-norm (sum of absolute values of elements) | |
| constexpr Norm | dxx::math::norms::infinity |
| Infinity norm (max absolute value across elements). | |
Linear algebra utilities for dxx::math.
Files | |
| file | //dot-xx-math/404a2e38e835a56e622ae6ce8e4a230638af3dbd/src/linalg/linalg.xx |
| Linear algebra utilities for dxx::math. | |
| file | //dot-xx-math/404a2e38e835a56e622ae6ce8e4a230638af3dbd/src/linalg/basic_ops.xx |
| Basic vector aritmetic. No documentation for functions since they are generated with macros (I know, I know, it was just too much to just write out...). | |
| file | //dot-xx-math/404a2e38e835a56e622ae6ce8e4a230638af3dbd/src/linalg/container_traits.xx |
| Traits that help the library where std::ranges API isn't enought. READ THE DESCRIPTION OF math::container_traits CAREFULLY. | |
| file | //dot-xx-math/404a2e38e835a56e622ae6ce8e4a230638af3dbd/src/linalg/cross.xx |
| Cross product of 3D vectors. | |
| file | //dot-xx-math/404a2e38e835a56e622ae6ce8e4a230638af3dbd/src/linalg/dot.xx |
| Dot product. | |
| file | //dot-xx-math/404a2e38e835a56e622ae6ce8e4a230638af3dbd/src/linalg/norm.xx |
| Vector norms. | |
| file | //dot-xx-math/404a2e38e835a56e622ae6ce8e4a230638af3dbd/src/linalg/traits.xx |
| Type traits and concepts for linear algebra utilities. | |