#include <subArray1D.h>
Public Member Functions | |
SubArray1D (const Array1D< Type > &source) | |
The single argument constructs a subarray referencing every element of the source array. | |
SubArray1D (const Array1D< Type > &source, const Slice &slice0) | |
This constructor permits slicing of the source array. | |
SubArray1D (const SubArray1D< Type > &other) | |
This is the copy constructor. | |
virtual | ~SubArray1D () |
Destroys the SubArray1D instance. | |
operator Array1D< Type > () const | |
This conversion operator generates an Array1D instance from a SubArray1D. | |
size_t | size () const |
This member function returns the number of elements referenced by *this. | |
size_t | start () const |
This member function returns the index of the first element referenced by *this. | |
size_t | stride () const |
This member function returns the spacing of the elements referenced by *this. | |
Array1D< Type > | getArray () const |
This method returns an Array1D instance referencing the same memory as the Array1D instance from which *this was constructed. | |
SubArray1D< Type > & | operator= (const SubArray1D< Type > &other) |
This assignment operator performs a deep copy, copying each element from other into *this. | |
SubArray1D< Type > & | operator= (Type value) |
This assignment operator sets each element reference by *this to the specified value. | |
SubArray1D< Type > & | operator+= (const SubArray1D< Type > &other) |
This operator increments each element of *this by the corresponding element of its argument. | |
SubArray1D< Type > & | operator-= (const SubArray1D< 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));
Note that this class has deep copy semantics.
Definition at line 37 of file subArray1D.h.
dlr::numeric::SubArray1D< Type >::SubArray1D | ( | const Array1D< Type > & | source | ) | [inline] |
The single argument constructs a subarray referencing every element of the source array.
source | This argument specifies the Array1D into which to index. |
Definition at line 313 of file subArray1D.h.
dlr::numeric::SubArray1D< Type >::SubArray1D | ( | const Array1D< Type > & | source, | |
const Slice & | slice0 | |||
) | [inline] |
This constructor permits slicing of the source array.
The resulting subarray references only those elements of the source array indicated by slice0.
source | This argument specifies the Array1D into which to index. | |
slice0 | This argument specifies which elements to include in the subArray. |
Definition at line 325 of file subArray1D.h.
References dlr::numeric::Array1D< Type >::size().
dlr::numeric::SubArray1D< Type >::SubArray1D | ( | const SubArray1D< Type > & | other | ) | [inline] |
This is the copy constructor.
After construction, *this will reference the same elements (of the same source array) as the copied SubArray1D instance.
other | This argument specifies the SubArray1D instance to be copied |
Definition at line 367 of file subArray1D.h.
virtual dlr::numeric::SubArray1D< Type >::~SubArray1D | ( | ) | [inline, virtual] |
Array1D<Type> dlr::numeric::SubArray1D< Type >::getArray | ( | ) | const [inline] |
dlr::numeric::SubArray1D< Type >::operator Array1D< Type > | ( | ) | const [inline] |
This conversion operator generates an Array1D instance from a SubArray1D.
The element values from the *this are copied into the newly created Array1D instance.
Definition at line 379 of file subArray1D.h.
References dlr::numeric::SubArray1D< Type >::size(), and dlr::numeric::subArray().
SubArray1D< Type > & dlr::numeric::SubArray1D< Type >::operator+= | ( | const SubArray1D< 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 SubArray1D instance, the elements of which will be added to the elements of *this. |
Definition at line 409 of file subArray1D.h.
References dlr::numeric::SubArray1D< Type >::m_source, dlr::numeric::SubArray1D< Type >::m_start, dlr::numeric::SubArray1D< Type >::m_stride, and dlr::numeric::SubArray1D< Type >::size().
SubArray1D< Type > & dlr::numeric::SubArray1D< Type >::operator-= | ( | const SubArray1D< 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 SubArray1D instance, the elements of which will be subtracted from the elements of *this. |
Definition at line 425 of file subArray1D.h.
References dlr::numeric::SubArray1D< Type >::m_source, dlr::numeric::SubArray1D< Type >::m_start, dlr::numeric::SubArray1D< Type >::m_stride, and dlr::numeric::SubArray1D< Type >::size().
SubArray1D< Type > & dlr::numeric::SubArray1D< 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 398 of file subArray1D.h.
References dlr::numeric::SubArray1D< Type >::size().
SubArray1D< Type > & dlr::numeric::SubArray1D< Type >::operator= | ( | const SubArray1D< 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 SubArray1D instance to be copied |
Definition at line 389 of file subArray1D.h.
size_t dlr::numeric::SubArray1D< Type >::size | ( | ) | const [inline] |
This member function returns the number of elements referenced by *this.
For example, if a SubArray1D references every third element of an 18 element Array1D, then its size() method will return 6.
Definition at line 100 of file subArray1D.h.
Referenced by dlr::numeric::SubArray1D< Type >::operator Array1D< Type >(), dlr::numeric::SubArray1D< Type >::operator+=(), dlr::numeric::SubArray1D< Type >::operator-=(), dlr::numeric::operator<<(), and dlr::numeric::SubArray1D< Type >::operator=().
size_t dlr::numeric::SubArray1D< Type >::start | ( | ) | const [inline] |
This member function returns the index of the first element referenced by *this.
For example, if a SubArray1D references every third element of an 18 element Array1D, starting from element 4, then its start() method will return 4.
Definition at line 112 of file subArray1D.h.
size_t dlr::numeric::SubArray1D< Type >::stride | ( | ) | const [inline] |
This member function returns the spacing of the elements referenced by *this.
For example, if a SubArray1D references every third element of an Array1D, then its stride() method will return 3.
Definition at line 124 of file subArray1D.h.