dakku::VectorBase
vector base More...
#include <vector_base.h>
Inherited by dakku::Point< int, 2 >, dakku::Point< float, 3 >, dakku::Vector< float, 3 >
Public Functions
Name | |
---|---|
VectorBase() Construct a new Vector Base object all components initialized to zero. |
|
template <ArithmeticType Arg> |
VectorBase(Arg value) Construct a new Vector Base object all components initalized to value |
VectorBase(const sol::table & table) Construct a new Vector Base object all components initalized to table. |
|
template <ArithmeticType Other,typename OtherDerived > |
VectorBase(const VectorBase< Other, S, OtherDerived > & other) Construct a new Vector Base object with given values. |
VectorBase(const VectorBase & other) | |
VectorBase(VectorBase && other) | |
VectorBase & | operator=(const VectorBase & other) |
VectorBase & | operator=(VectorBase && other) |
const D & | derived() const convert to derived type |
D & | derived() convert to derived type |
template <ArithmeticType Arg> void |
set(Arg value) set all components to value |
template <ArithmeticType Arg> void |
set_by_index(size_t index, Arg value) set data[index] to value |
template <ArithmeticType... Args,size_t... Is> void |
set(std::index_sequence< Is... > , Args &&... args) set data to args |
template <ArithmeticType... Args> void |
set(Args &&... args) set data to args |
template <ArithmeticType Other,typename OtherDerived > void |
set(const VectorBase< Other, S, OtherDerived > & rhs) set data by rhs 's data |
const T & | get(size_t i) const get i'th component |
size_t | size() const size of the vector |
std::string | to_string() const convert vector to string |
bool | has_nans() const check whether there are nan components |
D | clone() const get a copy |
const T & | operator[](size_t i) const get i'th value |
T & | operator[](size_t i) get i'th value |
D & | operator+=(const D & rhs) addition |
template <ArithmeticType V> D & |
operator+=(V rhs) addition |
D | operator+(const D & rhs) const addition |
template <ArithmeticType V> D |
operator+(V rhs) const addition |
D & | operator-=(const D & rhs) subtraction |
template <ArithmeticType V> D & |
operator-=(V rhs) subtraction |
D & | operator*=(const D & rhs) multiplication |
template <ArithmeticType V> D & |
operator*=(V rhs) multiplication |
D | operator*(const D & rhs) const multiplication |
template <ArithmeticType V> D |
operator*(V rhs) const multiplication |
D & | operator/=(const D & rhs) division |
template <ArithmeticType V> D & |
operator/=(V rhs) division |
D | operator/(const D & rhs) const division |
template <ArithmeticType U> D |
operator/(U rhs) const division |
bool | operator==(const VectorBase & rhs) const |
bool | operator!=(const VectorBase & rhs) const |
decltype(auto) | x() const get the first element |
decltype(auto) | x() get the first element |
decltype(auto) | y() const get the second element |
decltype(auto) | y() get the second element |
decltype(auto) | z() const get the third element |
decltype(auto) | z() get the fourth element |
decltype(auto) | w() const get the fourth element |
decltype(auto) | w() get the third element |
size_t | max_element_index() const get the index of the max element |
decltype(auto) | max_element() const get the max element in the vector |
D | max(const D & rhs) const element wise max |
D | min(const D & rhs) const element wise min |
template <typename OtherDerived > decltype(auto) |
dot(const VectorBase< T, S, OtherDerived > & rhs) const dot product between two vectors |
decltype(auto) | squared_norm() const squared norm |
decltype(auto) | norm() const norm |
decltype(auto) | length() const length |
decltype(auto) | distance(const D & rhs) const the distance |
D | abs() const abs |
D | cross(const D & rhs) const cross product |
bool | is_zero() const check whether all components are zero |
D | sqrt() const element-wise sqrt |
template <ArithmeticType E> D |
pow(E e) const element-wise power |
D | exp() const element-wise exp |
D | floor() const element-wise floor |
D | ceil() const element-wise ceil |
D | lerp(const D & b, T t) const element-wise linear interpolation |
operator std::span< T, S >() | |
operator std::span< const T, S >() const |
Friends
Name | |
---|---|
D | operator+(U a, const D & b) addition |
D | operator-(U a, const D & b) subtraction |
D | operator*(U a, const D & b) multiplication |
D | operator/(U a, const D & b) division |
std::ostream & | operator<<(std::ostream & os, const VectorBase & vec) output the vector |
D | max(const D & v1, const D & v2) element wise max |
D | min(const D & v1, const D & v2) element wise min |
decltype(auto) | distance(const D & a, const D & b) the distance |
D | abs(const D & v) abs |
D | sqrt(const D & v) element-wise sqrt |
D | pow(const D & v, E e) element-wise power |
D | exp(const D & v) element-wise exp |
D | floor(const D & v) element-wise floor |
D | ceil(const D & v) element-wise ceil |
D | lerp(const D & a, const D & b, T t) element-wise linear interpolation |
Detailed Description
vector base
Template Parameters:
- T type
- S size
- D derived
Public Functions Documentation
function VectorBase
Construct a new Vector Base object all components initialized to zero.
function VectorBase
Construct a new Vector Base object all components initalized to value
Parameters:
- value init value
Template Parameters:
- Arg value type
function VectorBase
Construct a new Vector Base object all components initalized to table.
function VectorBase
template <ArithmeticType Other,
typename OtherDerived >
inline explicit VectorBase(
const VectorBase< Other, S, OtherDerived > & other
)
Construct a new Vector Base object with given values.
Parameters:
- args init values
- expr the given expression
Template Parameters:
- Args value types
- Other
- OtherDerived
- Expr
Construct a new Vector Base object with a vector expression
function VectorBase
function VectorBase
function operator=
function operator=
function derived
convert to derived type
function derived
convert to derived type
function set
set all components to value
Parameters:
- value the given value
Template Parameters:
- Arg value type
function set_by_index
set data[index] to value
Parameters:
- index the index of the component
- value the given value
Template Parameters:
- Arg value type
function set
template <ArithmeticType... Args,
size_t... Is>
inline void set(
std::index_sequence< Is... > ,
Args &&... args
)
set data to args
Parameters:
- args values
Template Parameters:
- Args value types
- Is indices (generated by std::index_sequence_for)
function set
set data to args
Parameters:
- args values
Template Parameters:
- Args value types
function set
template <ArithmeticType Other,
typename OtherDerived >
inline void set(
const VectorBase< Other, S, OtherDerived > & rhs
)
set data by rhs
's data
Parameters:
- rhs the given vector
Template Parameters:
- Other
rhs
type - OtherDerived
rhs
derived type
function get
get i'th component
Parameters:
- i the index
Return: the value
function size
size of the vector
Return: size
function to_string
convert vector to string
Return: the converted string
function has_nans
check whether there are nan components
Return:
- true vector contains nan
- false vector does not contain nans
function clone
get a copy
function operator[]
get i'th value
Parameters:
- i index
Return: value
function operator[]
get i'th value
Parameters:
- i index
Return: value
function operator+=
addition
Parameters:
- rhs another vector
Return: this
function operator+=
addition
Parameters:
- rhs scalar
Return: this
function operator+
addition
Parameters:
- rhs another vector
Return: result
function operator+
addition
Parameters:
- rhs another vector
Return: result
function operator-=
subtraction
Parameters:
- rhs another vector
Return: this
function operator-=
subtraction
Parameters:
- rhs scalar
Return: this
function operator*=
multiplication
Parameters:
- rhs another vector
Return: this
function operator*=
multiplication
Parameters:
- rhs scalar
Return: this
function operator*
multiplication
Parameters:
- rhs another vector
Return: result
function operator*
multiplication
Parameters:
- rhs scalar
Return: result
function operator/=
division
Parameters:
- rhs another vector
Return: this
function operator/=
division
Parameters:
- rhs scalar
Return: this
function operator/
division
Parameters:
- rhs another vector
Return: result
function operator/
division
Parameters:
- rhs scalar
Return: result
function operator==
function operator!=
function x
get the first element
function x
get the first element
function y
get the second element
function y
get the second element
function z
get the third element
function z
get the fourth element
function w
get the fourth element
function w
get the third element
function max_element_index
get the index of the max element
Return: the index
function max_element
get the max element in the vector
Return: the max value
function max
element wise max
function min
element wise min
function dot
template <typename OtherDerived >
inline decltype(auto) dot(
const VectorBase< T, S, OtherDerived > & rhs
) const
dot product between two vectors
Return: \(\vec a \cdot \vec b\)
function squared_norm
squared norm
Return: \(||v|| ^ 2\)
function norm
norm
Return: \(||v||\)
function length
length
Return: \(||v||\)
function distance
the distance
function abs
abs
function cross
cross product
function is_zero
check whether all components are zero
function sqrt
element-wise sqrt
function pow
element-wise power
function exp
element-wise exp
function floor
element-wise floor
function ceil
element-wise ceil
function lerp
element-wise linear interpolation
function operator std::span< T, S >
function operator std::span< const T, S >
Friends
friend operator+
addition
Parameters:
- a\(aa\)
- b \(\vec b\)
Return: elementwise add a
friend operator-
subtraction
Parameters:
- a\(aa\)
- b \(\vec b\)
Return: elementwise sub
friend operator*
multiplication
Parameters:
- a\(aa\)
- b \(\vec b\)
Return: elementwise mul
friend operator/
division
Parameters:
- a\(aa\)
- b \(\vec b\)
Return: elementwise div (broad cast \(a\))
friend operator<<
output the vector
Parameters:
- os ostream
- vec the vector to output
Return: ostream
friend max
element wise max
friend min
element wise min
friend distance
the distance
friend abs
abs
friend sqrt
element-wise sqrt
friend pow
element-wise power
friend exp
element-wise exp
friend floor
element-wise floor
friend ceil
element-wise ceil
friend lerp
element-wise linear interpolation
Updated on 2022-04-30 at 15:46:11 +0000