Diana
0.8.3
|
Basic class definition for the dense arrays. More...
#include <DianaArray.hpp>
Public Types | |
typedef _T | tvalue |
Type of the array value. | |
typedef Common::Types::CapeArrayLong | tindices |
Type of the array indices. | |
typedef std::vector< tvalue > | tvalues |
Type of the values internal container. | |
typedef size_t | size_type |
Array size type. | |
Public Member Functions | |
array () | |
Default constructor creates no array. | |
array (const tindices &_dims) | |
Constructor creates array with predefined dimensions. | |
array (int nelems, tvalue *vals) | |
Constructor creates a vector. | |
array (std::vector< tvalue > vals) | |
Constructor creates a vector. | |
array (int nrows, int ncols) | |
Constructor creates two dimensional array. | |
array (const array &ar) | |
Array copy constructor. | |
array & | operator= (const array &ar) |
Array assignment operator. | |
virtual | ~array () |
Empty virtual dtor. | |
int | rank () const |
Returns number of dimensions. | |
size_type | size () const |
Returns the number of elements in the array. | |
const tindices & | dimensions () const |
Returns the dimensions of the array. | |
Common::Types::CapeBoolean | empty () const |
Returns true if the array is empty. | |
tvalue & | at (size_type __n) |
Provides access to the data contained in the array. | |
const tvalue & | at (size_type __n) const |
Provides access to the data contained in the array. | |
tvalue & | operator[] (size_type __n) |
Subscript access to the data contained in the array. | |
const tvalue & | operator[] (size_type __n) const |
Subscript access to the data contained in the array. | |
tvalue | front () const |
Returns a value of the first element in the array. | |
tvalue | back () const |
Returns a value of the last element in the array. | |
int | find (const tindices &idx) const |
Returns a position of the element in the array. | |
void | set_value (const tindices &idx, tvalue value) |
Assigns a value to array entry by its indices. | |
void | set_value (tvalue value) |
Assigns a value to the whole array. | |
void | set_values (const tvalues &_values) |
Assigns a vector with values to the whole array. | |
void | add_value (const tindices &idx, tvalue value) |
Adds a value to array entry by its indices. | |
tvalue | get_value (const tindices &idx) const |
Returns a value of the array entry by its indices. | |
tvalue | get_value (...) const |
Returns a value of the array entry by its indices. | |
const tvalues & | get_values () const |
Returns a vector with values of the whole array . | |
Private Member Functions | |
void | check_range (size_type __n, const char *func_name=NULL) const |
Updates a value of the array entry by its indices. | |
Private Attributes | |
tvalues | values |
Array data internal container. | |
tindices | dims |
Array dimensions. |
Basic class definition for the dense arrays.
Constructor creates array with predefined dimensions.
indices | Vector with dimensions sizes. Dimensions can not be changed during array object life time. |
Dimensions sizes are elements of the indices array, so the first dimension is indices[0], the second is indices[1], the last is indices.back() and the rank of the array is the indices.size() (here term rank used in the sense of tensors),
Constructor creates a vector.
nelems | Number of elements in the vector. |
Constructor creates a vector.
nelems | Number of elements in the vector. |
array | ( | int | nrows, |
int | ncols | ||
) | [inline] |
Constructor creates two dimensional array.
nrows | Number of rows. |
ncols | Number of columns. |
Array copy constructor.
ar | An array of identical element. |
Adds a value to array entry by its indices.
idx | Entry indices. |
value | Array entry increment. |
Provides access to the data contained in the array.
__n | The row major index of the element for which data should be accessed. |
std::string | If __n is an invalid index. |
This function provides for safer data access. The parameter is first checked that it is in the range of the array. The function throws std::string if the check fails.
Provides access to the data contained in the array.
__n | The row major index of the element for which data should be accessed. |
std::string | If __n is an invalid index. |
This function provides for safer data access. The parameter is first checked that it is in the range of the array. The function throws std::string if the check fails.
void check_range | ( | size_type | __n, |
const char * | func_name = NULL |
||
) | const [inline, private] |
Updates a value of the array entry by its indices.
idx | Entry indices. |
value | Update value. |
addition | Type of the update. For addition is true update will be addition, otherwise update will be assignment. Checks index in the range of the array. |
__n | The row major index of the element. |
func_name | Name of the testing function. |
std::string | If __n is an invalid index. |
Referenced by array< Common::Parameter::ICapeParameter * >::at().
Returns a position of the element in the array.
idx | Element indices. |
Referenced by array< Common::Parameter::ICapeParameter * >::add_value(), array< Common::Parameter::ICapeParameter * >::get_value(), and array< Common::Parameter::ICapeParameter * >::set_value().
Returns a value of the array entry by its indices.
idx | Entry indices. |
Referenced by array< Common::Parameter::ICapeParameter * >::get_value().
Returns a value of the array entry by its indices.
Number of arguments should be equal to the rank of the array. Type of arguments is int. This method is experimental, so it should be used very carefully.
Array assignment operator.
ar | An array of identical element. |
Subscript access to the data contained in the array.
__n | The row major index of the element for which data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().)
Subscript access to the data contained in the array.
__n | The row major index of the element for which data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().)
int rank | ( | ) | const [inline] |
Returns number of dimensions.
Here term rank is used in the sense of tensors and it is not a rank of the linear operator.
Referenced by array< Common::Parameter::ICapeParameter * >::get_value().
Assigns a value to array entry by its indices.
idx | Entry indices. |
value | New element value. |
Assigns a value to the whole array.
value | New array value. |
void set_values | ( | const tvalues & | _values | ) | [inline] |
Assigns a vector with values to the whole array.
_values | New array values. |