19 template<
typename T,
size_t N>
21 template<
typename T,
size_t N>
27 template<
typename T,
size_t N>
50 inline Array(T initValue);
60 inline Array(std::initializer_list<T> list);
80 operator std::array<T,N>()
const 83 for (
int ii = 0; ii < N; ii++)
85 arr[ii] = (*this)[ii];
96 inline Array(
const std::array<T,N>& arr);
107 inline void fill(T value);
115 inline const T*
data()
const;
235 inline T
max()
const;
239 inline T
min()
const;
247 inline T
sum()
const;
261 inline T
norm()
const;
276 inline std::string
str()
const;
279 inline void print(std::ostream& stream = std::cout)
const;
285 template<
typename T,
size_t N>
299 if (iter.
m_index != m_index) {
return false;}
304 return !(*
this == iter);
313 template<
typename T,
size_t N>
327 if (iter.
m_index != m_index) {
return false;}
332 return !(*
this == iter);
342 template<
typename T,
size_t N>
347 template<
typename T,
size_t N>
352 template<
typename T,
size_t N>
357 template<
typename T,
size_t N>
358 inline std::ostream& operator<<(std::ostream& stream, const Array<T,N>& arr);
ACCEL_DECORATION T max() const
Returns the maximum value of this.
ACCEL_DECORATION T sum() const
Returns the sum of the elements of this.
std::string str() const
Returns a string representation of this.
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...
Definition: Proto_Array.H:22
ACCEL_DECORATION void operator-=(const Array< T, M > &rhs)
Vector in-place subtraction operator. The first M elements of rhs are subtracted from this...
ACCEL_DECORATION ~Array()=default
ACCEL_DECORATION void fill(T value)
Sets all values of *this to value.
ACCEL_DECORATION T & operator[](size_t i)
Returns a reference to the element at index i.
ACCEL_DECORATION T min() const
Returns the minimum value of this.
ArrayIterator & operator--()
Definition: Proto_Array.H:307
ACCEL_DECORATION void operator*=(const Array< T, M > &rhs)
Vector in-place multiplication operator. The first M elements of rhs are multplied into this...
static ACCEL_DECORATION Array< T, N > Ones(T scale=1.0)
Shortcut for creating an isotropic array.
ConstArrayIterator & operator--()
Definition: Proto_Array.H:335
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 ...
ACCEL_DECORATION T * data()
Returns a raw pointer to the data buffer of *this.
ACCEL_DECORATION void operator+=(const Array< T, M > &rhs)
Vector in-place addition operator. The first M elements of rhs are added to this. ...
ACCEL_DECORATION bool operator==(const Array< T, N > &rhs) const
Equality operator. Defined by value.
ACCEL_DECORATION T product() const
Returns the product of the elements of this.
bool operator==(const ArrayIterator< T, N > &iter) const
Definition: Proto_Array.H:296
#define ACCEL_DECORATION
Definition: Proto_Accel.H:12
ACCEL_DECORATION ArrayIterator< T, N > end()
ACCEL_DECORATION Array()
Constructs an Array with uninitialized values.
bool operator==(const ConstArrayIterator< T, N > &iter) const
Definition: Proto_Array.H:324
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 ...
static ACCEL_DECORATION Array< T, N > Zeros()
Shortcut for creating an Array filled with zeros.
void print(std::ostream &stream=std::cout) const
Print a representation of this to a std::ostream [Default: std::cout].
ACCEL_DECORATION Array< T, N > & operator=(const Array< T, N > &arr)
int m_index
Definition: Proto_Array.H:310
Definition: Proto_Array.H:17
uint64_t index
Definition: Proto_MBBoxPartition.H:15
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 pr...
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.
T m_data[N]
Definition: Proto_Array.H:282
Definition: Proto_Array.H:20
Array< T, N > * m_data
Definition: Proto_Array.H:309
A templated constant size array object similar to std::array, but with the ability to be used inside ...
Definition: Proto_Array.H:28
ACCEL_DECORATION ArrayIterator< T, N > begin()
Integer Valued Vector.
Definition: Proto_Point.H:24
ConstArrayIterator(const Array< T, N > &arr, int index)
Definition: Proto_Array.H:317
ArrayIterator(Array< T, N > &arr, int index)
Definition: Proto_Array.H:289
int m_index
Definition: Proto_Array.H:338
ACCEL_DECORATION T absMax() const
Returns the maximum value of the absolute value of this.
ConstArrayIterator & operator++()
Definition: Proto_Array.H:334
ArrayIterator & operator++()
Definition: Proto_Array.H:306
T & operator*()
Definition: Proto_Array.H:295
const Array< T, N > * m_data
Definition: Proto_Array.H:337
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.
ACCEL_DECORATION bool operator!=(const Array< T, N > &rhs) const
Inequality operator. Defined by value.
Definition: Proto_Array.H:131
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...
const T & operator*()
Definition: Proto_Array.H:323