#include <subArray2D.h>
Public Member Functions | |
SubArray2D (const Array2D< Type > &source) | |
The single argument constructs a subarray referencing every element of the source array. | |
SubArray2D (const Array2D< Type > &source, const Slice &rowSlice, const Slice &columnSlice) | |
This constructor permits slicing of the source array. | |
SubArray2D (const SubArray2D< Type > &other) | |
This is the copy constructor. | |
virtual | ~SubArray2D () |
Destroys the SubArray2D instance. | |
operator Array2D< Type > () const | |
This conversion operator generates an Array2D instance from a SubArray2D. | |
size_t | rows () const |
This member function returns the number of rows referenced by *this. | |
size_t | columns () const |
This member function returns the number of columns referenced by *this. | |
size_t | startRow () const |
This member function returns the index of the first row referenced by *this. | |
size_t | startColumn () const |
This member function returns the index of the first column referenced by *this. | |
size_t | rowStride () const |
This member function returns the spacing of the rows referenced by *this. | |
size_t | columnStride () const |
This member function returns the spacing of the columns referenced by *this. | |
Array2D< Type > | getArray () const |
This method returns an Array2D instance referencing the same memory as the Array2D instance from which *this was constructed. | |
SubArray2D< Type > & | operator= (const SubArray2D< Type > &other) |
This assignment operator performs a deep copy, copying each element from other into *this. | |
SubArray2D< Type > & | operator= (Type value) |
This assignment operator sets each element reference by *this to the specified value. | |
SubArray2D< Type > & | operator+= (const SubArray2D< Type > &other) |
This operator increments each element of *this by the corresponding element of its argument. | |
SubArray2D< Type > & | operator-= (const SubArray2D< Type > &other) |
This operator decrements each element of *this by the corresponding element of its argument. |
This is not intended to be a full interface. Just enough to let you select and copy subArrays. Use this class via the function subArray(), like this:
subArray(array0) = subArray(array1, Slice(0, 6, 2), Slice(1, 4));
or
Array2D<double> array0 = subArray(array1, Slice(0, 6, 2), Slice(1, 4));
Note that this class has deep copy semantics.
Definition at line 40 of file subArray2D.h.
dlr::numeric::SubArray2D< Type >::SubArray2D | ( | const Array2D< Type > & | source | ) | [inline] |
The single argument constructs a subarray referencing every element of the source array.
source | This argument specifies the Array2D into which to index. |
Definition at line 406 of file subArray2D.h.
dlr::numeric::SubArray2D< Type >::SubArray2D | ( | const Array2D< Type > & | source, | |
const Slice & | rowSlice, | |||
const Slice & | columnSlice | |||
) | [inline] |
This constructor permits slicing of the source array.
The resulting subarray references only those elements of the source array which lie in rows indicated by rowSlice and also in columns indicated by columnSlice.
source | This argument specifies the Array2D into which to index. | |
rowSlice | This argument specifies which rows to include in the subArray. | |
columnSlice | This argument specifies which columns to include in the subArray. |
Definition at line 422 of file subArray2D.h.
References dlr::numeric::Array2D< Type >::columns(), and dlr::numeric::Array2D< Type >::rows().
dlr::numeric::SubArray2D< Type >::SubArray2D | ( | const SubArray2D< Type > & | other | ) | [inline] |
This is the copy constructor.
After construction, *this will reference the same elements (of the same source array) as the copied SubArray2D instance.
other | This argument specifies the SubArray2D instance to be copied |
Definition at line 487 of file subArray2D.h.
virtual dlr::numeric::SubArray2D< Type >::~SubArray2D | ( | ) | [inline, virtual] |
size_t dlr::numeric::SubArray2D< Type >::columns | ( | ) | const [inline] |
This member function returns the number of columns referenced by *this.
For example, if a SubArray2D references every third column of an 18 column Array2D, then its columns() method will return 6.
Definition at line 113 of file subArray2D.h.
Referenced by dlr::numeric::SubArray2D< Type >::operator Array2D< Type >(), dlr::numeric::SubArray2D< Type >::operator+=(), dlr::numeric::SubArray2D< Type >::operator-=(), dlr::numeric::operator<<(), and dlr::numeric::SubArray2D< Type >::operator=().
size_t dlr::numeric::SubArray2D< Type >::columnStride | ( | ) | const [inline] |
This member function returns the spacing of the columns referenced by *this.
For example, if a SubArray2D references every third column of an Array2D, then its columnStride() method will return 3.
Definition at line 156 of file subArray2D.h.
Array2D<Type> dlr::numeric::SubArray2D< Type >::getArray | ( | ) | const [inline] |
dlr::numeric::SubArray2D< Type >::operator Array2D< Type > | ( | ) | const [inline] |
This conversion operator generates an Array2D instance from a SubArray2D.
The element values from the *this are copied into the newly created Array2D instance.
Definition at line 502 of file subArray2D.h.
References dlr::numeric::SubArray2D< Type >::columns(), dlr::numeric::SubArray2D< Type >::rows(), and dlr::numeric::subArray().
SubArray2D< Type > & dlr::numeric::SubArray2D< Type >::operator+= | ( | const SubArray2D< Type > & | other | ) | [inline] |
This operator increments each element of *this by the corresponding element of its argument.
Note that this modifies the corresponding elements of the array from which *this was created.
other | This argument specifies a SubArray2D instance, the elements of which will be added to the elements of *this. |
Definition at line 540 of file subArray2D.h.
References dlr::numeric::SubArray2D< Type >::columns(), dlr::numeric::SubArray2D< Type >::m_columnStride, dlr::numeric::SubArray2D< Type >::m_rowStride, dlr::numeric::SubArray2D< Type >::m_source, dlr::numeric::SubArray2D< Type >::m_startColumn, dlr::numeric::SubArray2D< Type >::m_startRow, and dlr::numeric::SubArray2D< Type >::m_stopRow.
SubArray2D< Type > & dlr::numeric::SubArray2D< Type >::operator-= | ( | const SubArray2D< Type > & | other | ) | [inline] |
This operator decrements each element of *this by the corresponding element of its argument.
Note that this modifies the corresponding elements of the array from which *this was created.
other | This argument specifies a SubArray2D instance, the elements of which will be subtracted from the elements of *this. |
Definition at line 563 of file subArray2D.h.
References dlr::numeric::SubArray2D< Type >::columns(), dlr::numeric::SubArray2D< Type >::m_columnStride, dlr::numeric::SubArray2D< Type >::m_rowStride, dlr::numeric::SubArray2D< Type >::m_source, dlr::numeric::SubArray2D< Type >::m_startColumn, dlr::numeric::SubArray2D< Type >::m_startRow, and dlr::numeric::SubArray2D< Type >::m_stopRow.
SubArray2D< Type > & dlr::numeric::SubArray2D< Type >::operator= | ( | Type | value | ) | [inline] |
This assignment operator sets each element reference by *this to the specified value.
Note that this modifies the corresponding elements of the array from which *this was created.
value | This argument specifies the value to which the array elements should be set. |
Definition at line 524 of file subArray2D.h.
References dlr::numeric::SubArray2D< Type >::columns().
SubArray2D< Type > & dlr::numeric::SubArray2D< Type >::operator= | ( | const SubArray2D< Type > & | other | ) | [inline] |
This assignment operator performs a deep copy, copying each element from other into *this.
Note that this modifies the corresponding elements of the array from which *this was created.
other | This argument specifies the SubArray2D instance to be copied |
Definition at line 511 of file subArray2D.h.
size_t dlr::numeric::SubArray2D< Type >::rows | ( | ) | const [inline] |
This member function returns the number of rows referenced by *this.
For example, if a SubArray2D references every third row of an 18 row Array2D, then its rows() method will return 6.
Definition at line 102 of file subArray2D.h.
Referenced by dlr::numeric::SubArray2D< Type >::operator Array2D< Type >(), and dlr::numeric::operator<<().
size_t dlr::numeric::SubArray2D< Type >::rowStride | ( | ) | const [inline] |
This member function returns the spacing of the rows referenced by *this.
For example, if a SubArray2D references every third row of an Array2D, then its rowStride() method will return 3.
Definition at line 145 of file subArray2D.h.
size_t dlr::numeric::SubArray2D< Type >::startColumn | ( | ) | const [inline] |
This member function returns the index of the first column referenced by *this.
For example, if a SubArray2D references every third column of an 18 column Array2D, starting from column 4, then its startColumn() method will return 4.
Definition at line 135 of file subArray2D.h.
size_t dlr::numeric::SubArray2D< Type >::startRow | ( | ) | const [inline] |
This member function returns the index of the first row referenced by *this.
For example, if a SubArray2D references every third row of an 18 row Array2D, starting from row 4, then its startRow() method will return 4.
Definition at line 124 of file subArray2D.h.