ODIN
|
#include <tjarray.h>
Inherits STD_vector< unsigned long >.
Public Member Functions | |
ndim (unsigned long d=0) | |
ndim (const ndim &mm) | |
ndim (const STD_string &s) | |
unsigned long | dim () const |
operator STD_string () const | |
ndim & | operator-- () |
ndim & | operator-- (int) |
ndim & | add_dim (unsigned long e, bool first=false) |
unsigned long | total () const |
unsigned long | extent2index (const ndim &mm) const |
ndim | index2extent (unsigned long index) const |
bool | operator== (const ndim &nn) const |
bool | operator!= (const ndim &nn) const |
ndim & | reduce (unsigned long dim) |
ndim & | autosize () |
Friends | |
STD_ostream & | operator<< (STD_ostream &s, const ndim &nn) |
This class is an extent vector for arrays, i.e. it is used to hold dimension information of multidimensional arrays. It is a vector of integer numbers which describe the extent of the array in each direction/dimension. It can also be used to index a certain element in the multidimensional array.
ndim::ndim | ( | unsigned long | d = 0 | ) |
Constructs an extent vector of size 'd'.
ndim::ndim | ( | const STD_string & | s | ) |
Constructs an extent vector by parsing the string 's'. The string must have the syntax (i,j,...) e.g. (3,2,5) to describe a 3-dimensional array.
ndim& ndim::add_dim | ( | unsigned long | e, |
bool | first = false |
||
) |
Add new dimension with extent 'e' either as last or first dim, depending on 'first'
ndim& ndim::autosize | ( | ) |
Resize to essential dims, e.g. ( 1, 3, 1, 7).autosize() -> ( 3, 7 )
|
inline |
unsigned long ndim::extent2index | ( | const ndim & | mm | ) | const |
Converts an index vector to the linear index in the array.
ndim ndim::index2extent | ( | unsigned long | index | ) | const |
Converts the linear index in the array to an index vector.
ndim::operator STD_string | ( | ) | const |
Returns the extent vector as a formatted string, e.g. (3,2,5).
bool ndim::operator!= | ( | const ndim & | nn | ) | const |
Returns true if nn and this are unequal, otherwise false.
ndim& ndim::operator-- | ( | ) |
Prefix – operator: Strips of the first dimension/index.
ndim& ndim::operator-- | ( | int | ) |
Postfix – operator: Strips of the last dimension/index.
bool ndim::operator== | ( | const ndim & | nn | ) | const |
Returns true if nn and this are equal, otherwise false.
ndim& ndim::reduce | ( | unsigned long | dim | ) |
Reduce to dimension dim, e.g. ( 3, 4, 7).reduce(2) -> ( 12, 7 )
unsigned long ndim::total | ( | ) | const |
Returns the total product of the vector.
|
friend |