#include <MultiArray.hpp>
Inheritance diagram for MultiArray< T >:


Public Member Functions | |
| long | Dimension () const |
| Returns the dimensionality of the array. | |
| int | Length (int i) const |
| Returns the size for a given dimension. | |
| const Array< int > & | Lengths () const |
| Returns all the lengths. | |
| long | TotalNOfElements () const |
| Returns the total number of elem. in the array. | |
| long | SubArrayTotalLen (int n) const |
| Raw length of subarrays reference by first n indices. | |
| T * | Entries () |
| Returns the pointer to the 'raw' array of the entries. | |
| const T * | Entries () const |
| Returns a const-pointer to the 'raw' array of the entries. | |
| const T & | operator[] (long offset) const |
| An element by an absolute position. | |
| T & | operator[] (long offset) |
| An element by an absolute position. | |
| const T & | operator[] (const MultiIndex &index) const |
| References an element by a multiindex. | |
| T & | operator[] (const MultiIndex &index) |
| References an element by a multiindex. | |
| const T * | operator() (const MultiIndex &index) const |
| A subarray by a multiindex. | |
| T * | operator() (const MultiIndex &index) |
| A subarray by a multiindex. | |
| long | Offset (const MultiIndex &index, long d) const |
| The offset of an entry referenced by 'd' elems of 'index'. | |
| long | Offset (const MultiIndex &index) const |
| Returns the offset of an entry for a given multiindex. | |
| void | Position (long offset, MultiIndex &index) const |
| Computes the multiindex for an offset. | |
| MultiArray< T > & | operator= (const MultiArray< T > &src) |
| Standard assignment. | |
| MultiArray< T > & | operator= (const T &value) |
| Sets constant values to all the elements. | |
| void | SetZero () |
| Sets all the entries to zero. | |
| void | Reset () |
| Releases the memory, make the sizes undefined. | |
| void | Reset (const Array< int > &new_length, T *mem=NULL) |
| Sets the new sizes, reallocates memory. | |
| void | Reset (const Array< int > &new_length, int block_sz, T *mem=NULL) |
| Sets the new sizes with the block size, reallocates memory. | |
| void | Reset (int len, T *mem=NULL) |
| Sets new sizes and reallocates memory:. | |
| bool | NextPos (MultiIndex &index) const |
| Go lexicographically to the next position. | |
| bool | NextPos (MultiIndex &index, int range) const |
| Go to the next position in the subarray. | |
| bool | NextPos (MultiIndex &index, SelectedDim &subgrid) const |
| Go to the next position in the selected dimensions. | |
| void | SaveAsciiAs (char *file_name) |
| The ASCII output into a file (cf. 'operator <<' below):. | |
| void | ReadAsciiFrom (char *file_name) |
| The ASCII input into a file (cf. 'operator >>' below):. | |
| MultiArray () | |
| Zero sizes, no memory. | |
| MultiArray (const MultiArray< T > &ma) | |
| MultiArray (const Array< int > &len) | |
| MultiArray by given sizes. | |
| MultiArray (const Array< int > &len, int block_sz) | |
| MultiArray by given grid sizes and the additional block size. | |
| MultiArray (int len, T *mem=NULL) | |
| 1d MultiArray | |
Protected Attributes | |
| Array< T > | elements |
| Array< int > | length |
Friends | |
| std::ostream & | operator (std::ostream &, MultiArray< T > &) |
| std::istream & | operator>> (std::istream &, MultiArray< T > &) |
| The C++-style input operator. | |
MultiArray<T> is a multidimensional variable size array of elements of type <T>. Not only the sizes but also the dimensionality is variable. This template is used to represent grid functions (cf. MultiVector<T>) and other grid objects like sparse matrices (cf. SparseMatrix<T>). For MultiArray<T>, T may be any type.
There are two types of the indexation operators: [] and (). The first one references the entries of the array and has the return type T & so that you can you it for reading and writing the entries. If the argument of this operation is a multiindex, it must have the same length as 'length'. The second operator references subarrays. Its argument is a multiindex whose length may be less that that of 'length'. The operation returns the pointer to the subarray containing all the entries whose first indices coincide with the given ones.
| MultiArray< T >::MultiArray | ( | ) | [inline] |
Zero sizes, no memory.
| MultiArray< T >::MultiArray | ( | const MultiArray< T > & | ma | ) | [inline] |
Duplication
| MultiArray< T >::MultiArray | ( | const Array< int > & | len | ) | [inline] |
| MultiArray< T >::MultiArray | ( | const Array< int > & | len, | |
| int | block_sz | |||
| ) | [inline] |
MultiArray by given grid sizes and the additional block size.
| [in] | len | The sizes |
| [in] | block_sz | The additional dimension (the block size) |
| MultiArray< T >::MultiArray | ( | int | len, | |
| T * | mem = NULL | |||
| ) | [inline] |
1d MultiArray
| [in] | len | The length of the 1d array. |
| [in] | mem | The memory to place the 'T'-objects (optional). |
| long MultiArray< T >::Dimension | ( | ) | const [inline] |
Returns the dimensionality of the array.
| int MultiArray< T >::Length | ( | int | i | ) | const [inline] |
Returns the size for a given dimension.
| [in] | i | The dimension |
| const Array<int>& MultiArray< T >::Lengths | ( | ) | const [inline] |
Returns all the lengths.
| long MultiArray< T >::TotalNOfElements | ( | ) | const [inline] |
Returns the total number of elem. in the array.
| long MultiArray< T >::SubArrayTotalLen | ( | int | n | ) | const [inline] |
Raw length of subarrays reference by first n indices.
| [in] | n | Number of the first indices |
| T* MultiArray< T >::Entries | ( | ) | [inline] |
Returns the pointer to the 'raw' array of the entries.
| const T* MultiArray< T >::Entries | ( | ) | const [inline] |
Returns a const-pointer to the 'raw' array of the entries.
| const T& MultiArray< T >::operator[] | ( | long | offset | ) | const [inline] |
An element by an absolute position.
| [in] | offset | the position |
| T& MultiArray< T >::operator[] | ( | long | offset | ) | [inline] |
An element by an absolute position.
| [in] | offset | the position |
| const T & MultiArray< T >::operator[] | ( | const MultiIndex & | index | ) | const [inline] |
References an element by a multiindex.
The multiindex must have the same length as the dimensionality of the MultiArray
| [in] | index | The multiindex. |
| T & MultiArray< T >::operator[] | ( | const MultiIndex & | index | ) | [inline] |
References an element by a multiindex.
The multiindex must have the same length as the dimensionality of the MultiArray
| [in] | index | The multiindex. |
| const T* MultiArray< T >::operator() | ( | const MultiIndex & | index | ) | const [inline] |
A subarray by a multiindex.
| T* MultiArray< T >::operator() | ( | const MultiIndex & | index | ) | [inline] |
A subarray by a multiindex.
| long MultiArray< T >::Offset | ( | const MultiIndex & | index, | |
| long | d | |||
| ) | const [inline] |
The offset of an entry referenced by 'd' elems of 'index'.
| long MultiArray< T >::Offset | ( | const MultiIndex & | index | ) | const [inline] |
Returns the offset of an entry for a given multiindex.
| void MultiArray< T >::Position | ( | long | offset, | |
| MultiIndex & | index | |||
| ) | const [inline] |
Computes the multiindex for an offset.
The size of the 'index' argument ist set automatically.
| [in] | offset | The offset |
| [out] | index | To save the multiindex. |
| MultiArray<T>& MultiArray< T >::operator= | ( | const MultiArray< T > & | src | ) | [inline] |
Standard assignment.
'this' and 'src' may have different sizes.
| [in] | src | Source-array |
Reimplemented in MultiVector< T >.
| MultiArray<T>& MultiArray< T >::operator= | ( | const T & | value | ) | [inline] |
Sets constant values to all the elements.
| void MultiArray< T >::SetZero | ( | ) | [inline] |
Sets all the entries to zero.
| void MultiArray< T >::Reset | ( | ) | [inline] |
Releases the memory, make the sizes undefined.
| void MultiArray< T >::Reset | ( | const Array< int > & | new_length, | |
| T * | mem = NULL | |||
| ) | [inline] |
Sets the new sizes, reallocates memory.
| [in] | new_length | The new sizes |
| [in] | mem | (optionally) the memory where to place the 'T'-objects. |
| void MultiArray< T >::Reset | ( | const Array< int > & | new_length, | |
| int | block_sz, | |||
| T * | mem = NULL | |||
| ) | [inline] |
Sets the new sizes with the block size, reallocates memory.
| [in] | new_length | The new sizes |
| [in] | block_sz | Additional dimension (the block size) IFF != 1 |
| [in] | mem | The memory where to place the 'T'-objects (optional) |
| void MultiArray< T >::Reset | ( | int | len, | |
| T * | mem = NULL | |||
| ) | [inline] |
Sets new sizes and reallocates memory:.
The 1d version (creates a 1d array)
| [in] | len | The size of the 1d array. |
| [in] | mem | The memory where to place the 'T'-objects (optional). |
| bool MultiArray< T >::NextPos | ( | MultiIndex & | index | ) | const [inline] |
Go lexicographically to the next position.
| [in] | index | The index to update |
| bool MultiArray< T >::NextPos | ( | MultiIndex & | index, | |
| int | range | |||
| ) | const [inline] |
Go to the next position in the subarray.
| [in] | index | The index to update. |
| [in] | range | Only the first 'range' indices are considered and changed. |
| bool MultiArray< T >::NextPos | ( | MultiIndex & | index, | |
| SelectedDim & | subgrid | |||
| ) | const [inline] |
Go to the next position in the selected dimensions.
| [in] | index | The index to update. |
| [in] | subgrid | The selected subgrid. |
| void MultiArray< T >::SaveAsciiAs | ( | char * | file_name | ) | [inline] |
The ASCII output into a file (cf. 'operator <<' below):.
| [in] | file_name | The name of the file where to save |
| void MultiArray< T >::ReadAsciiFrom | ( | char * | file_name | ) | [inline] |
The ASCII input into a file (cf. 'operator >>' below):.
| [in] | file_name | The name of the file from where to load |
| std::ostream& operator | ( | std::ostream & | , | |
| MultiArray< T > & | ||||
| ) | [friend] |
| std::istream& operator>> | ( | std::istream & | , | |
| MultiArray< T > & | ||||
| ) | [friend] |
The C++-style input operator.
Reads values of the array from a stream in the format of operator << . On errors like memory lack the function throws an exception.
Array<T> MultiArray< T >::elements [protected] |
Keeps the entries, length! elements.
Array<int> MultiArray< T >::length [protected] |
Keeps the sizes for every dimension.
1.5.2