array dimensions descriptor
More...
#include <dims.h>
Public Member Functions |
| | dim4 () |
| | dim4 (unsigned x, unsigned y=1, unsigned z=1, unsigned w=1) |
| | If only x is specified, constructs column vector.
|
| | dim4 (unsigned ndims, const unsigned *dims) |
| | dim4 (const dim4 &) |
| unsigned | elements () const |
| | Number of elements (product of dimensions)
|
| unsigned | rest (unsigned i) const |
| | Product of dimensions i on.
|
| unsigned | numdims () const |
| | Number of dimensions set.
|
| const unsigned * | dims () const |
| | Access underlying array.
|
| bool | isempty () const |
| | Is empty array?
|
| bool | isscalar () const |
| | Is scalar array (one element)?
|
| bool | isvector () const |
| | Is array vector (row or column or scalar)?
|
| bool | iscolumn () const |
| | Is column vector?
|
| bool | isrow () const |
| | Is row vector?
|
| unsigned & | operator[] (unsigned) |
| | Get specified dimension.
|
| unsigned | operator[] (unsigned) const |
| | Get specified dimension.
|
| bool | operator== (const dim4 &) const |
| | Check is dimensions are equal.
|
| bool | operator!= (const dim4 &) const |
| | Check is dimensions are equal.
|
| dim4 & | operator= (const dim4 &) |
| | Copy constructor.
|
Friends |
| std::ostream & | operator<< (std::ostream &, const dim4 &) |
| | Prints dimensions.
|
Detailed Description
Constructor & Destructor Documentation
| dim4 |
( |
unsigned |
x, |
|
|
unsigned |
y = 1, |
|
|
unsigned |
z = 1, |
|
|
unsigned |
w = 1 |
|
) |
| |
If only x is specified, constructs column vector.
| dim4 |
( |
unsigned |
ndims, |
|
|
const unsigned * |
dims |
|
) |
| |
Member Function Documentation
| unsigned elements |
( |
| ) |
const |
Number of elements (product of dimensions)
array a = constant(0,5,5,5);
cout << a.dims().elements() << endl;
| unsigned rest |
( |
unsigned |
i | ) |
const |
Product of dimensions i on.
array a = constant(0,4,5,6);
cout << a.dims().rest(1) << endl;
| unsigned numdims |
( |
| ) |
const |
Number of dimensions set.
array a = constant(0,4,5,6);
cout << a.dims().numdims() << endl;
| const unsigned* dims |
( |
| ) |
const |
| bool isempty |
( |
| ) |
const [inline] |
Is empty array?
dim4 d(0);
return d.isempty();
| bool isscalar |
( |
| ) |
const [inline] |
Is scalar array (one element)?
dims4 d(1);
return d.iscalar();
| bool isvector |
( |
| ) |
const [inline] |
Is array vector (row or column or scalar)?
dim4 c(20);
dim4 r(1,20);
return c.isvector() && r.isvector();
| bool iscolumn |
( |
| ) |
const [inline] |
Is column vector?
dim4 c(20);
return c.iscolumn();
| bool isrow |
( |
| ) |
const [inline] |
Is row vector?
dim4 r(1,20);
return r.isrow();
| unsigned& operator[] |
( |
unsigned |
| ) |
|
Get specified dimension.
dim4 d(4,5,6,7);
unsigned& w = d[3];
| unsigned operator[] |
( |
unsigned |
| ) |
const |
Get specified dimension.
dim4 d(4,5,6,7);
const unsigned w = d[3];
| bool operator== |
( |
const dim4 & |
| ) |
const |
Check is dimensions are equal.
| bool operator!= |
( |
const dim4 & |
| ) |
const |
Check is dimensions are equal.
Copy constructor.
dim4 d(4,5,2);
dim4 e(2,1,1);
e = d;
cout << e[0] << endl;
Friends And Related Function Documentation
| std::ostream& operator<< |
( |
std::ostream & |
, |
|
|
const dim4 & |
|
|
) |
| [friend] |
Prints dimensions.
dim4 d(4,5);
cout << d << endl;
The documentation for this class was generated from the following file: