#include <array2D.h>
Public Types | |
typedef Type | value_type |
Typedef for value_type describes the contents of the array. | |
typedef Type * | iterator |
Typedef for iterator type helps with standard library interface. | |
typedef const Type * | const_iterator |
Typedef for const_iterator type helps with standard library interface. | |
Public Member Functions | |
Array2D () | |
Default constructor initializes to zero size. | |
Array2D (size_t arrayRows, size_t arrayColumns) | |
Constructs a "arrayRows x arrayColumns" element array. | |
Array2D (const std::string &inputString) | |
Construct from an initialization string. | |
Array2D (const Array2D< Type > &source) | |
The copy constructor does a shallow copy. | |
Array2D (size_t arrayRows, size_t arrayColumns, Type *const dataPtr) | |
Construct an array around external data. | |
Array2D (size_t arrayRows, size_t arrayColumns, Type *const dataPtr, size_t *referenceCountPtr) | |
Construct an array around external data which was allocated by an Array?D instance. | |
virtual | ~Array2D () |
Destroys the Array2D instance and deletes the internal data store if no remaining arrays point to it. | |
iterator | begin () |
Return begin() iterator for Standard Library algorithms. | |
const_iterator | begin () const |
Return begin() const_iterator for Standard Library algorithms. | |
void | clear () |
Reset the array to zero size, abandoning all contents. | |
size_t | columns () const |
Returns the array dimension along the "second" axis (the number of columns in the array. | |
void | checkDimension (size_t arrayRows, size_t arrayColumns) const |
Optionally throw an exception if the shape of *this is different than specified. | |
Array2D< Type > | copy () const |
Allocates a new array and deep copies the contents of *this. | |
template<class Type2 > | |
void | copy (const Array2D< Type2 > &source) |
Deep copies the contents of source. | |
template<class Type2 > | |
void | copy (const Type2 *dataPtr) |
Copies elements from dataPtr. | |
Type * | data () |
Returns a pointer to the internal data store. | |
const Type * | data () const |
This version of data(void) is appropriate for const Array2D, and returns a pointer-to-const. | |
Type * | data (size_t index) |
Just like data(void), which is documented above, but returns a pointer to the (index)th element instead of the first element. | |
const Type * | data (size_t index) const |
This version of data(size_t) is appropriate for const Array2D, and returns a pointer-to-const. | |
Type * | data (size_t rowIndex, size_t columnIndex) |
Just like data(void), which is documented above, but returns a pointer to the element indexed by (row, column). | |
const Type * | data (size_t rowIndex, size_t columnIndex) const |
This version of data(size_t, size_t) is appropriate for const Array2D, and returns a pointer-to-const. | |
bool | empty () const |
This member function returns true if the array instance contains no elements. | |
iterator | end () |
Return end() iterator for Standard Library algorithms. | |
const_iterator | end () const |
Return end() const_iterator for Standard Library algorithms. | |
Type | getElement (size_t index0) const |
This member function returns a specific element of the array by value. | |
Type | getElement (size_t rowIndex, size_t columnIndex) const |
This member function returns a specific element of the array by value. | |
Array1D< Type > | getRow (size_t index) |
Returns an Array1D<Type> which addresses an entire row of *this. | |
const Array1D< Type > | getRow (size_t index) const |
Returns a const Array1D<Type> which addresses an entire row of *this. | |
bool | isAllocated () const |
Indicates whether the internal data array is being managed (and reference counted) by *this. | |
Array1D< Type > | ravel () |
Returns an Array1D, with size equal to this->size(), which references the same data as *this. | |
const Array1D< Type > | ravel () const |
Returns a const Array1D, with size equal to this->size(), which references the same data as *this. | |
std::istream & | readFromStream (std::istream &inputStream) |
This member function sets the value of the array from an input stream. | |
size_t * | refCountPtr () const |
Temporary function to ease porting of code from early versions of dlr_libs. | |
void | reinit (size_t arrayRows, size_t arrayColumns) |
Changes the shape of the array and reallocates storage. | |
void | reinitIfNecessary (size_t arrayRows, size_t arrayColumns) |
Behaves just like member function reinit() unless *this already has the requested shape, in which case this member function does nothing, or *this has the requested size (but a different shape), in which case this member function behaves just like member function resize(). | |
void | reshape (int arrayRows, int arrayColumns) |
Changes the shape of the array. | |
Array1D< Type > | row (size_t index) |
This function is an alias for member function getRow(). | |
const Array1D< Type > | row (size_t index) const |
This function is an alias for member function getRow() const. | |
iterator | rowBegin (size_t rowIndex) |
Return a Standard Library style iterator which points to the beginning of the specified row. | |
const_iterator | rowBegin (size_t rowIndex) const |
Return a Standard Library style ocnst iterator which points to the beginning of the specified row. | |
iterator | rowEnd (size_t rowIndex) |
Return a Standard Library style iterator which points one element past the end of the specified row. | |
const_iterator | rowEnd (size_t rowIndex) const |
Return a Standard Library style const iterator which points one element past the end of the specified row. | |
size_t | rows () const |
Returns the array dimension along the "first" axis (the number of rows in the array. | |
Type & | setElement (size_t index0, const Type &value) |
This member function sets the value of a specific element of the array. | |
Type & | setElement (size_t rowIndex, size_t columnIndex, const Type &value) |
This member function sets the value of a specific element of the array. | |
Array1D< size_t > | shape () const |
Returns a 2 element Array1D containing the dimensions of *this along each axis. | |
size_t | shape (size_t axis) const |
Returns the array dimension along the the axis indicated by index. | |
size_t | size () const |
Returns the number of elements in the array. | |
Array2D< Type > | transpose () const |
Compute matrix transpose. | |
Array2D< Type > & | operator= (const Array2D< Type > &source) |
Assignment operator shallow copies the contents of source. | |
Array2D< Type > & | operator= (Type value) |
Assign value to every element in the array. | |
Type & | operator() (size_t index) |
Returns the (index)th element of the array by reference. | |
Type | operator() (size_t index) const |
Returns the (index)th element of the array by value. | |
Type & | operator() (size_t rowIndex, size_t columnIndex) |
Returns a specific element of the array by reference. | |
Type | operator() (size_t rowIndex, size_t columnIndex) const |
Returns a specific element of the array by value. | |
Type & | operator[] (size_t index) |
Returns the (index)th element of the array by reference. | |
Type | operator[] (size_t index) const |
Returns the (index)th element of the array by value. | |
template<class Type2 > | |
Array2D< Type > & | operator+= (const Array2D< Type2 > &arg) |
Increments each element of *this by the value of the corresponding element of arg. | |
template<class Type2 > | |
Array2D< Type > & | operator-= (const Array2D< Type2 > &arg) |
Decrements each element of *this by the value of the corresponding element of arg. | |
template<class Type2 > | |
Array2D< Type > & | operator*= (const Array2D< Type2 > &arg) |
Multiplies each element of *this by the value of the corresponding element of arg. | |
template<class Type2 > | |
Array2D< Type > & | operator/= (const Array2D< Type2 > &arg) |
Divides each element of *this by the value of the corresponding element of arg. | |
Array2D< Type > & | operator+= (Type arg) |
Increments each element of *this by a constant. | |
Array2D< Type > & | operator-= (Type arg) |
Decrements each element of *this by a constant. | |
Array2D< Type > & | operator*= (Type arg) |
Multiplies each element of *this by a constant. | |
Array2D< Type > & | operator/= (Type arg) |
Divides each element of *this by a constant. |
This class has internal reference counting.
IMPORTANT: This class does _shallow_ copies by default. If you type:
array1 = array2;
then array1 and array2 point to the same data. To do a deep copy, type
array1.copy(array2);
or
array1 = array2.copy();
The advantage of the first form is that it doesn't involve allocating memory. The advantage of the second form is that there's no error if array1 and array2 have different shapes.
Definition at line 52 of file array2D.h.
typedef const Type* dlr::numeric::Array2D< Type >::const_iterator |
typedef Type* dlr::numeric::Array2D< Type >::iterator |
typedef Type dlr::numeric::Array2D< Type >::value_type |
dlr::numeric::Array2D< Type >::Array2D | ( | ) | [inline] |
dlr::numeric::Array2D< Type >::Array2D | ( | size_t | arrayRows, | |
size_t | arrayColumns | |||
) | [inline] |
dlr::numeric::Array2D< Type >::Array2D | ( | const std::string & | inputString | ) | [inline, explicit] |
Construct from an initialization string.
The idea is to make constructor very flexible about interpreting string syntax. For now, though, the input string must have the format:
"[[#, #, #, ...], [#, #, #, ...], [#, #, #, ...], ...]"
Where "#" indicates text which can be converted to the element type of the array using the stream input operator.
inputString | The argument specifies the string from which the array will be constructed. |
dlr::numeric::Array2D< Type >::Array2D | ( | const Array2D< Type > & | source | ) | [inline] |
dlr::numeric::Array2D< Type >::Array2D | ( | size_t | arrayRows, | |
size_t | arrayColumns, | |||
Type *const | dataPtr | |||
) | [inline] |
Construct an array around external data.
Arrays constructed in this way will not implement reference counting, and will not delete dataPtr when done. The elements of the Array are organized in row-major order.
arrayRows | Number of rows in the array after successful construction. | |
arrayColumns | Number of columns in the array after successful construction. | |
dataPtr | A C-style array of Type into which the newly constructed Array2D should index. |
dlr::numeric::Array2D< Type >::Array2D | ( | size_t | arrayRows, | |
size_t | arrayColumns, | |||
Type *const | dataPtr, | |||
size_t * | referenceCountPtr | |||
) | [inline] |
Construct an array around external data which was allocated by an Array?D instance.
Arrays constructed in this way _do_ implement reference counting, and will delete dataPtr when done. This constructor is provided primarily so that other dimensionality array classes can return Array2D instances which reference their data without being friend classes. Caveat emptor.
arrayRows | This argument specifies the number of rows in the array. | |
arrayColumns | This argument specifies the number of columns in the array. | |
dataPtr | This argument is a C-style array containing the data to which the new Array2D instance should refer. | |
referenceCountPtr | This argument is a pointer to a pre-existing reference count for *dataPtr. |
dlr::numeric::Array2D< Type >::~Array2D | ( | ) | [inline, virtual] |
const_iterator dlr::numeric::Array2D< Type >::begin | ( | ) | const [inline] |
iterator dlr::numeric::Array2D< Type >::begin | ( | ) | [inline] |
Return begin() iterator for Standard Library algorithms.
Definition at line 172 of file array2D.h.
Referenced by dlr::numeric::BoxIntegrator2D< Type0, Type1 >::fillCache(), dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator==(), dlr::numeric::operator>(), dlr::numeric::operator>=(), dlr::numeric::Array2D< Type >::readFromStream(), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::setArray(), and dlr::numeric::squareRoot().
void dlr::numeric::Array2D< Type >::checkDimension | ( | size_t | arrayRows, | |
size_t | arrayColumns | |||
) | const [inline] |
Optionally throw an exception if the shape of *this is different than specified.
arrayRows | The required number of rows. | |
arrayColumns | The required number of columns. |
Definition at line 1467 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns(), and dlr::numeric::Array2D< Type >::rows().
Referenced by dlr::numeric::operator==().
void dlr::numeric::Array2D< Type >::clear | ( | ) | [inline] |
Reset the array to zero size, abandoning all contents.
This is equivalent to this->reinit(0, 0);
Definition at line 188 of file array2D.h.
Referenced by dlr::numeric::Array3D< Type >::readFromStream().
size_t dlr::numeric::Array2D< Type >::columns | ( | ) | const [inline] |
Returns the array dimension along the "second" axis (the number of columns in the array.
) This is synonymous with shape(1), but may execute faster.
Definition at line 198 of file array2D.h.
Referenced by dlr::numeric::Array2D< Type >::checkDimension(), dlr::numeric::correlate2D(), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::fillCache(), dlr::numeric::Array2D< Type >::getRow(), dlr::numeric::operator*(), dlr::numeric::Array2D< Type >::operator*=(), dlr::numeric::operator+(), dlr::numeric::Array2D< Type >::operator+=(), dlr::numeric::operator-(), dlr::numeric::Array2D< Type >::operator-=(), dlr::numeric::operator/(), dlr::numeric::Array2D< Type >::operator/=(), dlr::numeric::operator==(), dlr::numeric::operator>(), dlr::numeric::operator>=(), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::setArray(), dlr::numeric::BSpline2D< Type >::setControlPoints(), dlr::numeric::Stencil2D< Type, Size >::setPattern(), dlr::numeric::Stencil2D< Type, Size >::setTarget(), dlr::numeric::Array2D< Type >::shape(), dlr::numeric::squareRoot(), dlr::numeric::SubArray2D< Type >::SubArray2D(), dlr::numeric::Transform2D::Transform2D(), dlr::numeric::Transform3D::Transform3D(), and dlr::numeric::Transform3DTo2D::Transform3DTo2D().
void dlr::numeric::Array2D< Type >::copy | ( | const Type2 * | dataPtr | ) | [inline] |
void dlr::numeric::Array2D< Type >::copy | ( | const Array2D< Type2 > & | source | ) | [inline] |
Deep copies the contents of source.
It is an error if source does not have the same size as *this. Note that source need not have exactly the same number of rows and columns as *this, as long as their product is right.
source | The array to be copied. |
ValueException | thrown when array sizes do not match. |
Definition at line 1496 of file array2D.h.
References dlr::numeric::Array2D< Type >::copy(), dlr::numeric::Array2D< Type >::data(), and dlr::numeric::Array2D< Type >::size().
Array2D< Type > dlr::numeric::Array2D< Type >::copy | ( | ) | const [inline] |
Allocates a new array and deep copies the contents of *this.
Definition at line 1486 of file array2D.h.
References dlr::numeric::Array2D< Type >::copy().
Referenced by dlr::numeric::Array2D< Type >::copy(), dlr::numeric::Array2D< Type >::readFromStream(), and dlr::numeric::BSpline2D< Type >::setControlPoints().
const Type* dlr::numeric::Array2D< Type >::data | ( | size_t | rowIndex, | |
size_t | columnIndex | |||
) | const [inline] |
This version of data(size_t, size_t) is appropriate for const Array2D, and returns a pointer-to-const.
rowIndex | The row of the element to which the return value should point. | |
columnIndex | The column of the element to which the return value should point. |
Type* dlr::numeric::Array2D< Type >::data | ( | size_t | rowIndex, | |
size_t | columnIndex | |||
) | [inline] |
Just like data(void), which is documented above, but returns a pointer to the element indexed by (row, column).
rowIndex | The row of the element to which the return value should point. | |
columnIndex | The column of the element to which the return value should point. |
const Type* dlr::numeric::Array2D< Type >::data | ( | size_t | index | ) | const [inline] |
This version of data(size_t) is appropriate for const Array2D, and returns a pointer-to-const.
index | Indicates to which element of the array the return value should point. |
Type* dlr::numeric::Array2D< Type >::data | ( | size_t | index | ) | [inline] |
Just like data(void), which is documented above, but returns a pointer to the (index)th element instead of the first element.
Note that "data(index)" is synonymous with "data() + index" .
index | Indicates to which element of the array the return value should point. |
const Type* dlr::numeric::Array2D< Type >::data | ( | void | ) | const [inline] |
This version of data(void) is appropriate for const Array2D, and returns a pointer-to-const.
Type* dlr::numeric::Array2D< Type >::data | ( | void | ) | [inline] |
Returns a pointer to the internal data store.
This is ugly but often necessary for interfacing with external libraries. Data is stored contiguously in raster order. The first element corresponds to indices (0, 0), the second to (0, 1), the (columns + 1)th element corresponds to index (1, 0), and so on.
Definition at line 253 of file array2D.h.
Referenced by dlr::numeric::Array2D< Type >::copy(), dlr::numeric::Array2D< Type >::operator*=(), dlr::numeric::Array2D< Type >::operator+=(), dlr::numeric::Array2D< Type >::operator-=(), dlr::numeric::Array2D< Type >::operator/=(), dlr::numeric::Stencil2D< Type, Size >::setTarget(), and dlr::numeric::Array2D< Type >::transpose().
bool dlr::numeric::Array2D< Type >::empty | ( | ) | const [inline] |
const_iterator dlr::numeric::Array2D< Type >::end | ( | ) | const [inline] |
iterator dlr::numeric::Array2D< Type >::end | ( | ) | [inline] |
Return end() iterator for Standard Library algorithms.
Definition at line 349 of file array2D.h.
Referenced by dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator==(), dlr::numeric::operator>(), dlr::numeric::operator>=(), dlr::numeric::Array2D< Type >::readFromStream(), and dlr::numeric::squareRoot().
Type dlr::numeric::Array2D< Type >::getElement | ( | size_t | rowIndex, | |
size_t | columnIndex | |||
) | const [inline] |
This member function returns a specific element of the array by value.
rowIndex | This argument and the next specify which element value should be returned. | |
columnIndex | This argument and the previous specify which element value should be returned. |
Type dlr::numeric::Array2D< Type >::getElement | ( | size_t | index0 | ) | const [inline] |
const Array1D< Type > dlr::numeric::Array2D< Type >::getRow | ( | size_t | index | ) | const [inline] |
Returns a const Array1D<Type> which addresses an entire row of *this.
The returned Array1D references the same data as the selected row of *this, and is valid only as long as *this is valid.
index | Specifies which row to reference. |
Definition at line 1537 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns().
Array1D< Type > dlr::numeric::Array2D< Type >::getRow | ( | size_t | index | ) | [inline] |
Returns an Array1D<Type> which addresses an entire row of *this.
The returned Array1D references the same data as the selected row of *this, and is valid only as long as *this is valid.
index | Specifies which row to reference. |
Definition at line 1527 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns().
Referenced by dlr::numeric::Array2D< Type1 >::row().
bool dlr::numeric::Array2D< Type >::isAllocated | ( | ) | const [inline] |
Indicates whether the internal data array is being managed (and reference counted) by *this.
This member function is only needed in very unusual circumstances.
Type dlr::numeric::Array2D< Type >::operator() | ( | size_t | rowIndex, | |
size_t | columnIndex | |||
) | const [inline] |
Type& dlr::numeric::Array2D< Type >::operator() | ( | size_t | rowIndex, | |
size_t | columnIndex | |||
) | [inline] |
Type dlr::numeric::Array2D< Type >::operator() | ( | size_t | index | ) | const [inline] |
Type& dlr::numeric::Array2D< Type >::operator() | ( | size_t | index | ) | [inline] |
Returns the (index)th element of the array by reference.
Elements are indexed in row-major order.
index | Indicates the selected element. |
Definition at line 734 of file array2D.h.
Referenced by dlr::numeric::Array2D< Type1 >::getElement(), dlr::numeric::Array2D< Type1 >::operator[](), and dlr::numeric::Array2D< Type1 >::setElement().
Array2D< Type > & dlr::numeric::Array2D< Type >::operator*= | ( | Type | arg | ) | [inline] |
Array2D< Type > & dlr::numeric::Array2D< Type >::operator*= | ( | const Array2D< Type2 > & | arg | ) | [inline] |
Multiplies each element of *this by the value of the corresponding element of arg.
arg | Array2D of values by which the elements of *this are to be multiplied. |
ValueException | thrown when array sizes differ. |
Definition at line 1818 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::data(), dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().
Array2D< Type > & dlr::numeric::Array2D< Type >::operator+= | ( | Type | arg | ) | [inline] |
Array2D< Type > & dlr::numeric::Array2D< Type >::operator+= | ( | const Array2D< Type2 > & | arg | ) | [inline] |
Increments each element of *this by the value of the corresponding element of arg.
arg | Array2D of values to be added to the elements of *this. |
ValueException | thrown when array sizes differ. |
Definition at line 1778 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::data(), dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().
Array2D< Type > & dlr::numeric::Array2D< Type >::operator-= | ( | Type | arg | ) | [inline] |
Array2D< Type > & dlr::numeric::Array2D< Type >::operator-= | ( | const Array2D< Type2 > & | arg | ) | [inline] |
Decrements each element of *this by the value of the corresponding element of arg.
arg | Array2D of values to be subtracted from the elements of *this. |
ValueException | thrown when array sizes differ. |
Definition at line 1798 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::data(), dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().
Array2D< Type > & dlr::numeric::Array2D< Type >::operator/= | ( | Type | arg | ) | [inline] |
Array2D< Type > & dlr::numeric::Array2D< Type >::operator/= | ( | const Array2D< Type2 > & | arg | ) | [inline] |
Divides each element of *this by the value of the corresponding element of arg.
arg | Array2D of values by which the elements of *this are to be divided. |
ValueException | thrown when array sizes differ. |
Definition at line 1838 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::data(), dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().
Array2D< Type > & dlr::numeric::Array2D< Type >::operator= | ( | Type | value | ) | [inline] |
Array2D< Type > & dlr::numeric::Array2D< Type >::operator= | ( | const Array2D< Type > & | source | ) | [inline] |
Assignment operator shallow copies the contents of source.
After the copy, both arrays reference the same data.
source | The Array2D instance to be copied. |
Definition at line 1756 of file array2D.h.
References dlr::numeric::Array2D< Type >::m_columns, dlr::numeric::Array2D< Type >::m_dataPtr, dlr::numeric::Array2D< Type >::m_isAllocated, dlr::numeric::Array2D< Type >::m_refCountPtr, dlr::numeric::Array2D< Type >::m_rows, and dlr::numeric::Array2D< Type >::m_size.
Type dlr::numeric::Array2D< Type >::operator[] | ( | size_t | index | ) | const [inline] |
Returns the (index)th element of the array by value.
Synonymous with operator()(size_t) const.
index | Indicates the selected element. |
Type& dlr::numeric::Array2D< Type >::operator[] | ( | size_t | index | ) | [inline] |
Returns the (index)th element of the array by reference.
Synonymous with operator()(size_t).
index | Indicates the selected element. |
const Array1D< Type > dlr::numeric::Array2D< Type >::ravel | ( | ) | const [inline] |
Array1D< Type > dlr::numeric::Array2D< Type >::ravel | ( | ) | [inline] |
std::istream & dlr::numeric::Array2D< Type >::readFromStream | ( | std::istream & | inputStream | ) | [inline] |
This member function sets the value of the array from an input stream.
The array is modified only if the read was successful, otherwise the array is not modified, and failbit is set in the stream state. Because of this nice behavior, readFromStream is quite slow.
inputStream | This is the stream from which to read the array. |
Definition at line 1569 of file array2D.h.
References dlr::numeric::Array2D< Type >::begin(), dlr::numeric::Array1D< Type >::clear(), dlr::numeric::Array2D< Type >::copy(), dlr::numeric::Array2D< Type >::end(), dlr::numeric::Array2D< Type >::reinit(), and dlr::numeric::Array2D< Type >::size().
Referenced by dlr::numeric::operator>>().
size_t* dlr::numeric::Array2D< Type >::refCountPtr | ( | ) | const [inline] |
void dlr::numeric::Array2D< Type >::reinit | ( | size_t | arrayRows, | |
size_t | arrayColumns | |||
) | [inline] |
Changes the shape of the array and reallocates storage.
The current array contents are lost. After a successful call to reinit(), the array will be arrayRows x arrayColumns.
arrayRows | Requested row dimension. | |
arrayColumns | Requested column dimension. |
Definition at line 1662 of file array2D.h.
Referenced by dlr::numeric::Array2D< Type1 >::clear(), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::fillCache(), dlr::numeric::Array2D< Type >::readFromStream(), and dlr::numeric::Array2D< Type >::reinitIfNecessary().
void dlr::numeric::Array2D< Type >::reinitIfNecessary | ( | size_t | arrayRows, | |
size_t | arrayColumns | |||
) | [inline] |
Behaves just like member function reinit() unless *this already has the requested shape, in which case this member function does nothing, or *this has the requested size (but a different shape), in which case this member function behaves just like member function resize().
arrayRows | Requested row dimension. | |
arrayColumns | Requested column dimension. |
Definition at line 1673 of file array2D.h.
References dlr::numeric::Array2D< Type >::reinit(), dlr::numeric::Array2D< Type >::reshape(), dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().
void dlr::numeric::Array2D< Type >::reshape | ( | int | arrayRows, | |
int | arrayColumns | |||
) | [inline] |
Changes the shape of the array.
It is an error if (arrayRows * arrayColumns) is not equal to this->size(). Either arrayRows or arrayColumns may be specified as -1, but not both. If one of the arguments is -1, its value will be calculated based on the total size of the array and the value of the other argument.
arrayRows | Requested row dimension. | |
arrayColumns | Requested column dimension. |
ValueException | thrown when old and new array sizes do not match. |
Definition at line 1688 of file array2D.h.
References dlr::numeric::Array2D< Type >::size().
Referenced by dlr::numeric::Array2D< Type >::reinitIfNecessary().
const Array1D<Type> dlr::numeric::Array2D< Type >::row | ( | size_t | index | ) | const [inline] |
Array1D<Type> dlr::numeric::Array2D< Type >::row | ( | size_t | index | ) | [inline] |
This function is an alias for member function getRow().
index | Specifies which row to reference. |
Definition at line 533 of file array2D.h.
Referenced by dlr::numeric::BSpline< Type >::operator()().
const_iterator dlr::numeric::Array2D< Type >::rowBegin | ( | size_t | rowIndex | ) | const [inline] |
Return a Standard Library style ocnst iterator which points to the beginning of the specified row.
rowIndex | Specifies which row if the array should be referenced. Row 0 is the top row. |
iterator dlr::numeric::Array2D< Type >::rowBegin | ( | size_t | rowIndex | ) | [inline] |
Return a Standard Library style iterator which points to the beginning of the specified row.
rowIndex | Specifies which row if the array should be referenced. Row 0 is the top row. |
Definition at line 558 of file array2D.h.
Referenced by dlr::numeric::BoxIntegrator2D< Type0, Type1 >::fillCache().
const_iterator dlr::numeric::Array2D< Type >::rowEnd | ( | size_t | rowIndex | ) | const [inline] |
Return a Standard Library style const iterator which points one element past the end of the specified row.
rowIndex | Specifies which row if the array should be referenced. Row 0 is the top row. |
iterator dlr::numeric::Array2D< Type >::rowEnd | ( | size_t | rowIndex | ) | [inline] |
Return a Standard Library style iterator which points one element past the end of the specified row.
rowIndex | Specifies which row if the array should be referenced. Row 0 is the top row. |
Definition at line 588 of file array2D.h.
Referenced by dlr::numeric::BoxIntegrator2D< Type0, Type1 >::fillCache().
size_t dlr::numeric::Array2D< Type >::rows | ( | ) | const [inline] |
Returns the array dimension along the "first" axis (the number of rows in the array.
) This is synonymous with shape(0), but may execute faster.
Definition at line 617 of file array2D.h.
Referenced by dlr::numeric::Array2D< Type >::checkDimension(), dlr::numeric::correlate2D(), dlr::numeric::operator*(), dlr::numeric::Array2D< Type >::operator*=(), dlr::numeric::operator+(), dlr::numeric::Array2D< Type >::operator+=(), dlr::numeric::operator-(), dlr::numeric::Array2D< Type >::operator-=(), dlr::numeric::operator/(), dlr::numeric::Array2D< Type >::operator/=(), dlr::numeric::operator==(), dlr::numeric::operator>(), dlr::numeric::operator>=(), dlr::numeric::Array2D< Type >::reinitIfNecessary(), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::setArray(), dlr::numeric::BSpline2D< Type >::setControlPoints(), dlr::numeric::Stencil2D< Type, Size >::setPattern(), dlr::numeric::Stencil2D< Type, Size >::setTarget(), dlr::numeric::Array2D< Type >::shape(), dlr::numeric::squareRoot(), dlr::numeric::SubArray2D< Type >::SubArray2D(), dlr::numeric::Transform2D::Transform2D(), dlr::numeric::Transform3D::Transform3D(), and dlr::numeric::Transform3DTo2D::Transform3DTo2D().
Type& dlr::numeric::Array2D< Type >::setElement | ( | size_t | rowIndex, | |
size_t | columnIndex, | |||
const Type & | value | |||
) | [inline] |
This member function sets the value of a specific element of the array.
row | This argument and the next specify which element value should be set. | |
column | This argument and the previous specify which element value should be set. | |
value | This argument will be copied into the selected array element. |
Type& dlr::numeric::Array2D< Type >::setElement | ( | size_t | index0, | |
const Type & | value | |||
) | [inline] |
This member function sets the value of a specific element of the array.
index0 | This argument specifies which element value should be set. | |
value | This argument will be copied into the selected array element. |
size_t dlr::numeric::Array2D< Type >::shape | ( | size_t | axis | ) | const [inline] |
Returns the array dimension along the the axis indicated by index.
This is synonymous with shape()[axis], but may execute faster.
axis | Selected axis. |
ValueException | thrown on invalid axis parameter. |
Definition at line 1723 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns(), and dlr::numeric::Array2D< Type >::rows().
Array1D< size_t > dlr::numeric::Array2D< Type >::shape | ( | ) | const [inline] |
Returns a 2 element Array1D containing the dimensions of *this along each axis.
That is, the first element of the returned array will be this->rows(), and the second element will be this->columns().
Definition at line 1712 of file array2D.h.
References dlr::numeric::Array2D< Type >::columns(), and dlr::numeric::Array2D< Type >::rows().
size_t dlr::numeric::Array2D< Type >::size | ( | ) | const [inline] |
Returns the number of elements in the array.
This is the product of rows() and columns().
Definition at line 693 of file array2D.h.
Referenced by dlr::numeric::Array2D< Type >::copy(), dlr::numeric::Array2D< Type1 >::empty(), dlr::numeric::Array2D< Type >::operator*=(), dlr::numeric::Array2D< Type >::operator+=(), dlr::numeric::Array2D< Type >::operator-=(), dlr::numeric::Array2D< Type >::operator/=(), dlr::numeric::Array2D< Type >::readFromStream(), dlr::numeric::Array2D< Type >::reinitIfNecessary(), dlr::numeric::Array2D< Type >::reshape(), and dlr::numeric::Stencil2D< Type, Size >::setTarget().
Array2D< Type > dlr::numeric::Array2D< Type >::transpose | ( | ) | const [inline] |
Compute matrix transpose.
The resulting array does not reference the same memory as *this.
Definition at line 1901 of file array2D.h.
References dlr::numeric::Array2D< Type >::data(), and dlr::numeric::Array2D< Type >::m_dataPtr.