|
| constexpr T & | operator() (int idx) |
| | operator ()
|
| |
| constexpr const T & | operator() (int idx) const |
| | operator () const
|
| |
| constexpr T & | operator[] (int idx) |
| | operator []
|
| |
| constexpr const T & | operator[] (int idx) const |
| | operator [] const
|
| |
| constexpr Vector< T, N > | operator+ (const Vector< T, N > &other) const |
| | operator + for vector addition
|
| |
| constexpr Vector< T, N > | operator- (const Vector< T, N > &other) const |
| | operator - for vector subtraction
|
| |
| constexpr Vector< T, N > | operator+ () const |
| | operator +
|
| |
| constexpr Vector< T, N > | operator- () const |
| | operator - for vector negation
|
| |
| constexpr Vector< T, N > | operator* (const Vector< T, N > &other) const |
| | vector batch multiplication
|
| |
| constexpr Vector< T, N > | operator/ (const Vector< T, N > &other) const |
| | vector batch division
|
| |
| constexpr Vector< T, N > | operator+ (T val) const |
| | vector addition with value
|
| |
| constexpr Vector< T, N > | operator- (T val) const |
| | vector subtraction with value
|
| |
| constexpr Vector< T, N > | operator* (T val) const |
| | vector multiplication with value
|
| |
| constexpr Vector< T, N > | operator/ (T val) const |
| | vector division with value
|
| |
| constexpr Vector< bool, N > | operator== (const Vector< T, N > &other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator== (T other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator!= (const Vector< T, N > &other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator!= (T other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator> (const Vector< T, N > &other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator> (T other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator< (const Vector< T, N > &other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator< (T other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator>= (const Vector< T, N > &other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator>= (T other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator<= (const Vector< T, N > &other) const |
| | vector logical operations
|
| |
| constexpr Vector< bool, N > | operator<= (T other) const |
| | vector logical operations
|
| |
| constexpr Vector< T, N > & | operator+= (const Vector< T, N > &other) |
| | vector in-place addition
|
| |
| constexpr Vector< T, N > & | operator-= (const Vector< T, N > &other) |
| | vector in-place subtraction
|
| |
| constexpr Vector< T, N > & | operator*= (const Vector< T, N > &other) |
| | vector in-place batch multiplication
|
| |
| constexpr Vector< T, N > & | operator/= (const Vector< T, N > &other) |
| | vector in-place batch division
|
| |
| constexpr Vector< T, N > & | operator+= (T val) |
| | vector in-place addition with value
|
| |
| constexpr Vector< T, N > & | operator-= (T val) |
| | vector in-place subtraction with value
|
| |
| constexpr Vector< T, N > & | operator*= (T val) |
| | vector in-place multiplication with value
|
| |
| constexpr Vector< T, N > & | operator/= (T val) |
| | vector in-place division with value
|
| |
| constexpr T | dot (const Vector< T, N > &other) const |
| | vector dot product
|
| |
| T | length () const |
| | vector length in L2 norm
|
| |
| Vector< T, N > | normalize () const |
| | vector normalize in L2 norm
|
| |
| constexpr T | max () const |
| | Max element in vector
|
| |
| constexpr T | min () const |
| | Min element in vector
|
| |
| constexpr T | sum () const |
| | sum of all elements
|
| |
| constexpr T | average () const |
| | average of all elements
|
| |
|
void | apply (SelfApplyFunc func) |
| |
|
template<size_t begin, size_t end, size_t step = 1> |
| Vector< T,(end - begin)/step > | slice () const |
| |
| constexpr Vector< T, N > | remap (const Vector< int, N > &idx) |
| | remap the vector with given index
|
| |
|
| static constexpr Vector< T, N > | clamp (const Vector< T, N > &val, const Vector< T, N > &min, const Vector< T, N > &max) |
| | clamp val to min and max
|
| |
| static constexpr Vector< T, N > | abs (const Vector< T, N > &val) |
| | abs val
|
| |
| static constexpr Vector< T, N > | min (const Vector< T, N > &val1, const Vector< T, N > &val2) |
| | min val1 and val2
|
| |
| static constexpr Vector< T, N > | max (const Vector< T, N > &val1, const Vector< T, N > &val2) |
| | max val1 and val2
|
| |
| static constexpr Vector< T, N > | clamp (const Vector< T, N > &val, T min, T max) |
| | clamp val to min and max
|
| |
| static constexpr Vector< T, N > | max (const Vector< T, N > &val, T max) |
| | max val to max
|
| |
| static constexpr Vector< T, N > | min (const Vector< T, N > &val, T min) |
| | min val to min
|
| |
| static constexpr Vector< T, N > | zeros () |
| | create a vector with all elements set to 0
|
| |
| static constexpr Vector< T, N > | ones () |
| | create a vector with all elements set to 1
|
| |
| static Vector< T, N > | apply (const Vector< T, N > &val, ApplyFunc func) |
| | apply function to vector element
|
| |
| static Vector< T, N > | rand () |
| | create a vector with random elements between 0 and 1
|
| |
| static constexpr Vector< T, N > | where (const Vector< bool, N > &cond, const Vector< T, N > &val1, const Vector< T, N > &val2) |
| | Return a vector of elements selected from either val1 or val2, depending on condition.
|
| |
| static constexpr Vector< bool, N > | eq (const Vector< T, N > &val1, const Vector< T, N > &val2) |
| | Computes element-wise equality
|
| |
| static constexpr Vector< bool, N > | eq (const Vector< T, N > &val1, T val2) |
| | Computes element-wise equality
|
| |
| static constexpr Vector< bool, N > | ne (const Vector< T, N > &val1, const Vector< T, N > &val2) |
| | Computes element-wise not equal to
|
| |
| static constexpr Vector< bool, N > | ne (const Vector< T, N > &val1, T val2) |
| | Computes element-wise not equal to
|
| |
template<typename T, size_t N>
class z::math::Vector< T, N >
Vector class, support some vector operations, like dot, cross, normalize, etc.
- 模板参数
-
| T | type of vector element |
| N | length of vector |