Proto
3.2
|
A templated constant size array object similar to std::array, but with the ability to be used inside of device kernels. More...
#include <Proto_Array.H>
Public Member Functions | |
ACCEL_DECORATION | Array () |
Constructs an Array with uninitialized values. More... | |
ACCEL_DECORATION | Array (T initValue) |
Constructs an Array with all values set to initValue. More... | |
ACCEL_DECORATION | Array (std::initializer_list< T > list) |
Constructs an Array using initializer_list syntax. More... | |
ACCEL_DECORATION | Array (const Array< T, N > &arr) |
ACCEL_DECORATION Array< T, N > & | operator= (const Array< T, N > &arr) |
ACCEL_DECORATION | Array (Array< T, N > &&arr)=default |
ACCEL_DECORATION Array< T, N > & | operator= (Array< T, N > &&arr)=default |
ACCEL_DECORATION Array< T, N > & | operator= (const std::array< T, N > &arr) |
ACCEL_DECORATION | operator std::array< T, N > () const |
Implicit Cast to std::array. More... | |
ACCEL_DECORATION | Array (const Point &point) |
Constructs an int-valued Array from a Point. More... | |
ACCEL_DECORATION | Array (const std::array< T, N > &arr) |
Constructs an Array from a std::array. More... | |
ACCEL_DECORATION | ~Array ()=default |
ACCEL_DECORATION void | fill (T value) |
Sets all values of *this to value. More... | |
ACCEL_DECORATION T * | data () |
Returns a raw pointer to the data buffer of *this. More... | |
ACCEL_DECORATION const T * | data () const |
Returns a const raw pointer to the data buffer of *this. More... | |
ACCEL_DECORATION T & | operator[] (size_t i) |
Returns a reference to the element at index i. More... | |
ACCEL_DECORATION const T & | operator[] (size_t i) const |
Returns a const reference to the element at index i. More... | |
ACCEL_DECORATION bool | operator== (const Array< T, N > &rhs) const |
Equality operator. Defined by value. More... | |
ACCEL_DECORATION bool | operator!= (const Array< T, N > &rhs) const |
Inequality operator. Defined by value. More... | |
template<size_t M> | |
ACCEL_DECORATION Array< T, N > | operator+ (const Array< T, M > &rhs) const |
Vector addition operator. Returns a new Array of the same size as *this. if M < N, the elements of rhs are added to the first M elements of the output. More... | |
ACCEL_DECORATION Array< T, N > | operator+ (T value) const |
Scalar addition operator. Returns a new Array containing the values of *this + value. More... | |
template<size_t M> | |
ACCEL_DECORATION void | operator+= (const Array< T, M > &rhs) |
Vector in-place addition operator. The first M elements of rhs are added to this. More... | |
ACCEL_DECORATION void | operator+= (T value) |
Scalar in-place addition operator. Adds value to each element of *this. More... | |
template<size_t M> | |
ACCEL_DECORATION Array< T, N > | operator- (const Array< T, M > &rhs) const |
Vector subtraction operator. Returns a new Array of the same size as *this. if M < N, the elements of rhs are subtracted from the first M elements of the output. More... | |
ACCEL_DECORATION Array< T, N > | operator- (T value) const |
Scalar subtraction operator. Subtracts value from each element of *this. More... | |
template<size_t M> | |
ACCEL_DECORATION void | operator-= (const Array< T, M > &rhs) |
Vector in-place subtraction operator. The first M elements of rhs are subtracted from this. More... | |
ACCEL_DECORATION void | operator-= (T value) |
Scalar in-place subtraction operator. Subtracts value from each element of *this. More... | |
template<size_t M> | |
ACCEL_DECORATION Array< T, N > | operator* (const Array< T, M > &rhs) const |
Vector product operator. Returns a new Array of the same size as *this. if M < N, the elements of rhs are multiplied with the first M elements of the output. More... | |
ACCEL_DECORATION Array< T, N > | operator* (T value) const |
Scalar multiplication operator. Multiplies each element of *this by value. More... | |
template<size_t M> | |
ACCEL_DECORATION void | operator*= (const Array< T, M > &rhs) |
Vector in-place multiplication operator. The first M elements of rhs are multplied into this. More... | |
ACCEL_DECORATION void | operator*= (T value) |
Scalar in-place multiplication operator. Multiplies each value of *this by value. More... | |
template<size_t M> | |
ACCEL_DECORATION Array< T, N > | operator/ (const Array< T, M > &nonZeroRhs) const |
Vector quotient operator. Returns a new Array of the same size as *this. if M < N, the elements of rhs are divided by the first M elements of the output. Fails by assertion if any element of rhs contains zero. More... | |
ACCEL_DECORATION Array< T, N > | operator/ (T nonZeroValue) const |
Scalar quotient operator. Divides each element of *this by value. Fails by assertion if value is zero. More... | |
template<size_t M> | |
ACCEL_DECORATION void | operator/= (const Array< T, M > &nonZeroRhs) |
Vector in-place quotient operator. The first M elements this are divided by rhs elementwise Fails by assertion if any element of rhs is zero. More... | |
ACCEL_DECORATION void | operator/= (T nonZeroValue) |
Scalar in-place quotient operator. Divides each value of *this by value. Fails by assertion of value is zero. More... | |
ACCEL_DECORATION T | max () const |
Returns the maximum value of this. More... | |
ACCEL_DECORATION T | min () const |
Returns the minimum value of this. More... | |
ACCEL_DECORATION T | absMax () const |
Returns the maximum value of the absolute value of this. More... | |
ACCEL_DECORATION T | sum () const |
Returns the sum of the elements of this. More... | |
ACCEL_DECORATION T | dot (const Array< T, N > &rhs) const |
Returns the dot product of this with rhs. The dot product is defined as the sum of the elementwise products of the elements of the two Arrays. More... | |
ACCEL_DECORATION T | product () const |
Returns the product of the elements of this. More... | |
ACCEL_DECORATION T | norm () const |
Returns the L2 norm of the elements of this. The L2 norm is defined as the square root of the sum of the squared elements of this. More... | |
ACCEL_DECORATION ArrayIterator< T, N > | begin () |
ACCEL_DECORATION ConstArrayIterator< T, N > | begin () const |
ACCEL_DECORATION ArrayIterator< T, N > | end () |
ACCEL_DECORATION ConstArrayIterator< T, N > | end () const |
std::string | str () const |
Returns a string representation of this. More... | |
void | print (std::ostream &stream=std::cout) const |
Print a representation of this to a std::ostream [Default: std::cout]. More... | |
Static Public Member Functions | |
static ACCEL_DECORATION Array< T, N > | Zeros () |
Shortcut for creating an Array filled with zeros. More... | |
static ACCEL_DECORATION Array< T, N > | Ones (T scale=1.0) |
Shortcut for creating an isotropic array. More... | |
Private Attributes | |
T | m_data [N] |
A templated constant size array object similar to std::array, but with the ability to be used inside of device kernels.
T | a plain-old-data type (int, double, etc) |
N | static size of the array |
|
inline |
Constructs an Array with uninitialized values.
Referenced by Proto::Array< vector< uint64_t >, DIM >::operator std::array< vector< uint64_t >, N >().
|
inline |
|
inline |
|
inline |
|
inlinedefault |
|
inline |
|
inline |
Constructs an Array from a std::array.
|
inlinedefault |
|
inlinestatic |
|
inlinestatic |
Shortcut for creating an isotropic array.
scale | - An optional scale. The output vector will be [scale, scale, scale, ...]. [Default: 1] |
|
inline |
|
inlinedefault |
|
inline |
|
inline |
Implicit Cast to std::array.
|
inline |
Sets all values of *this to value.
Referenced by Proto::Array< vector< uint64_t >, DIM >::operator std::array< vector< uint64_t >, N >().
|
inline |
Returns a raw pointer to the data buffer of *this.
Referenced by Proto::Array< vector< uint64_t >, DIM >::operator std::array< vector< uint64_t >, N >().
|
inline |
Returns a const raw pointer to the data buffer of *this.
|
inline |
Returns a reference to the element at index i.
Referenced by Proto::Array< vector< uint64_t >, DIM >::operator std::array< vector< uint64_t >, N >().
|
inline |
Returns a const reference to the element at index i.
|
inline |
Equality operator. Defined by value.
Referenced by Proto::Array< vector< uint64_t >, DIM >::operator std::array< vector< uint64_t >, N >().
|
inline |
Inequality operator. Defined by value.
|
inline |
Vector addition operator. Returns a new Array of the same size as *this. if M < N, the elements of rhs are added to the first M elements of the output.
M | - The number of elements in rhs |
rhs | - Another Array |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Scalar addition operator. Returns a new Array containing the values of *this + value.
|
inline |
Vector in-place addition operator. The first M elements of rhs are added to this.
M | - The number of elements in rhs |
rhs | - Another Array |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Scalar in-place addition operator. Adds value to each element of *this.
|
inline |
Vector subtraction operator. Returns a new Array of the same size as *this. if M < N, the elements of rhs are subtracted from the first M elements of the output.
M | - The number of elements in rhs |
rhs | - Another Array |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Scalar subtraction operator. Subtracts value from each element of *this.
|
inline |
Vector in-place subtraction operator. The first M elements of rhs are subtracted from this.
M | - The number of elements in rhs |
rhs | - Another Array |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Scalar in-place subtraction operator. Subtracts value from each element of *this.
|
inline |
Vector product operator. Returns a new Array of the same size as *this. if M < N, the elements of rhs are multiplied with the first M elements of the output.
M | - The number of elements in rhs |
rhs | - Another Array |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Scalar multiplication operator. Multiplies each element of *this by value.
|
inline |
Vector in-place multiplication operator. The first M elements of rhs are multplied into this.
M | - The number of elements in rhs |
rhs | - Another Array |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Scalar in-place multiplication operator. Multiplies each value of *this by value.
|
inline |
Vector quotient operator. Returns a new Array of the same size as *this. if M < N, the elements of rhs are divided by the first M elements of the output. Fails by assertion if any element of rhs contains zero.
M | - The number of elements in rhs |
rhs | - Another Array |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Scalar quotient operator. Divides each element of *this by value. Fails by assertion if value is zero.
|
inline |
Vector in-place quotient operator. The first M elements this are divided by rhs elementwise Fails by assertion if any element of rhs is zero.
M | - The number of elements in rhs |
rhs | - Another Array |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Scalar in-place quotient operator. Divides each value of *this by value. Fails by assertion of value is zero.
|
inline |
Returns the maximum value of this.
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Returns the minimum value of this.
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Returns the maximum value of the absolute value of this.
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Returns the sum of the elements of this.
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Returns the dot product of this with rhs. The dot product is defined as the sum of the elementwise products of the elements of the two Arrays.
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Returns the product of the elements of this.
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Returns the L2 norm of the elements of this. The L2 norm is defined as the square root of the sum of the squared elements of this.
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
|
inline |
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
|
inline |
Returns a string representation of this.
Referenced by Proto::Array< bool, DIM >::operator!=().
|
inline |
Print a representation of this to a std::ostream [Default: std::cout].
Referenced by Proto::Array< bool, DIM >::operator!=().
|
private |
Referenced by Proto::ArrayIterator< T, N >::ArrayIterator(), Proto::ConstArrayIterator< T, N >::ConstArrayIterator(), Proto::ArrayIterator< T, N >::operator*(), Proto::ConstArrayIterator< T, N >::operator*(), Proto::ArrayIterator< T, N >::operator==(), and Proto::ConstArrayIterator< T, N >::operator==().