Generic object that represents size and shape. More...
#include <dim4.hpp>
Public Member Functions | |
dim4 () | |
Default constructor. Creates an invalid dim4 object. More... | |
dim4 (dim_t first, dim_t second=1, dim_t third=1, dim_t fourth=1) | |
Creates an new dim4 given a set of dimension. More... | |
dim4 (const dim4 &other) | |
Copy constructor. More... | |
dim4 (const unsigned ndims, const dim_t *const dims) | |
Constructs a dim4 object from a C array of dim_t objects. More... | |
dim_t | elements () |
Returns the number of elements represented by this dim4. More... | |
dim_t | elements () const |
Returns the number of elements represented by this dim4. More... | |
dim_t | ndims () |
Returns the number of axis whose values are greater than one. More... | |
dim_t | ndims () const |
Returns the number of axis whose values are greater than one. More... | |
bool | operator== (const dim4 &other) const |
Returns true if the two dim4 represent the same shape. More... | |
bool | operator!= (const dim4 &other) const |
Returns true if two dim4s store different values. More... | |
dim4 & | operator*= (const dim4 &other) |
Element-wise multiplication of the dim4 objects. More... | |
dim4 & | operator+= (const dim4 &other) |
Element-wise addition of the dim4 objects. More... | |
dim4 & | operator-= (const dim4 &other) |
Element-wise subtraction of the dim4 objects. More... | |
dim_t & | operator[] (const unsigned dim) |
Returns the reference to the element at a give index. More... | |
const dim_t & | operator[] (const unsigned dim) const |
Returns the reference to the element at a give index. More... | |
dim_t * | get () |
Returns the underlying pointer to the dim4 object. More... | |
const dim_t * | get () const |
Returns the underlying pointer to the dim4 object. More... | |
Data Fields | |
dim_t | dims [4] |
Generic object that represents size and shape.
Creates an new dim4 given a set of dimension.
Constructs a dim4 object from a C array of dim_t objects.
Creates a new dim4 from a C array. If the C array is less than 4, all values past ndims
will be assigned the value 1.
[in] | ndims | The number of elements in the C array. Must be less than 4 |
[in] | dims | The values to assign to each element of dim4 |
|
inline |
|
inline |
dim_t ndims | ( | ) |
Returns the number of axis whose values are greater than one.
dim_t ndims | ( | ) | const |
Returns the number of axis whose values are greater than one.
bool operator!= | ( | const dim4 & | other | ) | const |
Returns true if two dim4s store different values.
dim_t & operator[] | ( | const unsigned | dim | ) |
Returns the reference to the element at a give index.
(Must be less than 4)
const dim_t & operator[] | ( | const unsigned | dim | ) | const |
Returns the reference to the element at a give index.
(Must be less than 4)