A high-performance general-purpose compute library
dim4 Class Reference

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...
 
dim4operator*= (const dim4 &other)
 Element-wise multiplication of the dim4 objects. More...
 
dim4operator+= (const dim4 &other)
 Element-wise addition of the dim4 objects. More...
 
dim4operator-= (const dim4 &other)
 Element-wise subtraction of the dim4 objects. More...
 
dim_toperator[] (const unsigned dim)
 Returns the reference to the element at a give index. More...
 
const dim_toperator[] (const unsigned dim) const
 Returns the reference to the element at a give index. More...
 
dim_tget ()
 Returns the underlying pointer to the dim4 object. More...
 
const dim_tget () const
 Returns the underlying pointer to the dim4 object. More...
 

Data Fields

dim_t dims [4]
 

Detailed Description

Constructor & Destructor Documentation

◆ dim4() [1/4]

dim4 ( )

Default constructor. Creates an invalid dim4 object.

◆ dim4() [2/4]

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.

◆ dim4() [3/4]

dim4 ( const dim4 other)

Copy constructor.

Parameters
[in]otherThe dim4 that will be copied

◆ dim4() [4/4]

dim4 ( const unsigned  ndims,
const dim_t *const  dims 
)

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.

Parameters
[in]ndimsThe number of elements in the C array. Must be less than 4
[in]dimsThe values to assign to each element of dim4

Member Function Documentation

◆ elements() [1/2]

dim_t elements ( )

Returns the number of elements represented by this dim4.

◆ elements() [2/2]

dim_t elements ( ) const

Returns the number of elements represented by this dim4.

◆ get() [1/2]

dim_t * get ( )
inline

Returns the underlying pointer to the dim4 object.

Definition at line 103 of file dim4.hpp.

103{ return dims; }
dim_t dims[4]
Definition: dim4.hpp:28

◆ get() [2/2]

const dim_t * get ( ) const
inline

Returns the underlying pointer to the dim4 object.

Definition at line 106 of file dim4.hpp.

106{ return dims; }

◆ ndims() [1/2]

dim_t ndims ( )

Returns the number of axis whose values are greater than one.

◆ ndims() [2/2]

dim_t ndims ( ) const

Returns the number of axis whose values are greater than one.

◆ operator!=()

bool operator!= ( const dim4 other) const

Returns true if two dim4s store different values.

◆ operator*=()

dim4 & operator*= ( const dim4 other)

Element-wise multiplication of the dim4 objects.

◆ operator+=()

dim4 & operator+= ( const dim4 other)

Element-wise addition of the dim4 objects.

◆ operator-=()

dim4 & operator-= ( const dim4 other)

Element-wise subtraction of the dim4 objects.

◆ operator==()

bool operator== ( const dim4 other) const

Returns true if the two dim4 represent the same shape.

◆ operator[]() [1/2]

dim_t & operator[] ( const unsigned  dim)

Returns the reference to the element at a give index.

(Must be less than 4)

◆ operator[]() [2/2]

const dim_t & operator[] ( const unsigned  dim) const

Returns the reference to the element at a give index.

(Must be less than 4)

Field Documentation

◆ dims

dim_t dims[4]

Definition at line 28 of file dim4.hpp.


The documentation for this class was generated from the following file: