dlr::numeric::Array2D< Type > Class Template Reference

The Array2D class template represents a 2D array of arbitrary type. More...

#include <array2D.h>

Inheritance diagram for dlr::numeric::Array2D< Type >:

Inheritance graph
[legend]
Collaboration diagram for dlr::numeric::Array2D< Type >:

Collaboration graph
[legend]
List of all members.

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 rows, size_t columns)
 Constructs a "rows x columns" 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 rows, size_t columns, Type *const dataPtr)
 Construct an array around external data.
 Array2D (size_t rows, size_t columns, Type *const dataPtr, size_t *refCountPtr)
 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 rows, size_t columns) 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 row, size_t column)
 Just like data(void), which is documented above, but returns a pointer to the element indexed by (row, column).
const Type * data (size_t row, size_t column) 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.
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 rows, size_t columns)
 Changes the shape of the array and reallocates storage.
void reshape (int rows, int columns)
 Changes the shape of the array.
Array1D< Type > row (size_t index)
 Returns an Array1D<Type> which addresses an entire row of *this.
const Array1D< Type > row (size_t index) const
 Returns a const Array1D<Type> which addresses an entire row of *this.
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.
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 row, size_t column)
 Returns a specific element of the array by reference.
Type operator() (size_t row, size_t column) 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.

Detailed Description

template<class Type>
class dlr::numeric::Array2D< Type >

The Array2D class template represents a 2D array of arbitrary type.

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.


Member Typedef Documentation

template<class Type>
typedef Type dlr::numeric::Array2D< Type >::value_type

Typedef for value_type describes the contents of the array.

Definition at line 60 of file array2D.h.

template<class Type>
typedef Type* dlr::numeric::Array2D< Type >::iterator

Typedef for iterator type helps with standard library interface.

Definition at line 65 of file array2D.h.

template<class Type>
typedef const Type* dlr::numeric::Array2D< Type >::const_iterator

Typedef for const_iterator type helps with standard library interface.

Definition at line 71 of file array2D.h.


Constructor & Destructor Documentation

template<class Type>
dlr::numeric::Array2D< Type >::Array2D (  )  [inline]

Default constructor initializes to zero size.

Definition at line 1236 of file array2D.h.

template<class Type>
dlr::numeric::Array2D< Type >::Array2D ( size_t  rows,
size_t  columns 
) [inline]

Constructs a "rows x columns" element array.

Parameters:
rows Number of rows in the array after successful construction.
columns Number of columns in the array after successful construction.

Definition at line 1249 of file array2D.h.

template<class Type>
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.

Parameters:
inputString The argument specifies the string from which the array will be constructed.

Definition at line 1264 of file array2D.h.

References DLR_THROW3.

template<class Type>
dlr::numeric::Array2D< Type >::Array2D ( const Array2D< Type > &  source  )  [inline]

The copy constructor does a shallow copy.

The newly created array points to the same data as copied array.

Parameters:
source The Array2D<> instance to be copied.

Definition at line 1295 of file array2D.h.

template<class Type>
dlr::numeric::Array2D< Type >::Array2D ( size_t  rows,
size_t  columns,
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.

Parameters:
rows Number of rows in the array after successful construction.
columns Number of columns in the array after successful construction.
dataPtr A C-style array of Type into which the newly constructed Array2D should index.

Definition at line 1313 of file array2D.h.

template<class Type>
dlr::numeric::Array2D< Type >::Array2D ( size_t  rows,
size_t  columns,
Type *const   dataPtr,
size_t *  refCountPtr 
) [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.

Parameters:
rows This argument specifies the number of rows in the array.
columns 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.
refCountPtr This argument is a pointer to a pre-existing reference count for *dataPtr.

Definition at line 1329 of file array2D.h.

template<class Type>
dlr::numeric::Array2D< Type >::~Array2D (  )  [inline, virtual]

Destroys the Array2D instance and deletes the internal data store if no remaining arrays point to it.

Definition at line 1344 of file array2D.h.


Member Function Documentation

template<class Type>
iterator dlr::numeric::Array2D< Type >::begin (  )  [inline]

Return begin() iterator for Standard Library algorithms.

Returns:
Iterator pointing to the first element of the Array2D.

Definition at line 170 of file array2D.h.

Referenced by dlr::numeric::abs(), dlr::numeric::getMeanAndCovariance(), dlr::numeric::logicalNot(), 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().

template<class Type>
const_iterator dlr::numeric::Array2D< Type >::begin (  )  const [inline]

Return begin() const_iterator for Standard Library algorithms.

Returns:
Const iterator pointing to the first element of the array.

Definition at line 179 of file array2D.h.

template<class Type>
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 186 of file array2D.h.

Referenced by dlr::numeric::Array3D< Type >::readFromStream().

template<class Type>
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.

Returns:
Number of columns.

Definition at line 196 of file array2D.h.

Referenced by dlr::numeric::abs(), dlr::numeric::axisMaximum(), dlr::numeric::axisMinimum(), dlr::numeric::axisSum(), dlr::numeric::Array2D< Type >::checkDimension(), dlr::numeric::correlate2D(), dlr::numeric::getMeanAndCovariance(), dlr::numeric::logicalNot(), dlr::numeric::matrixMultiply(), dlr::numeric::operator *(), dlr::numeric::Array2D< Type >::operator *=(), dlr::numeric::BilinearInterpolator< 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 >::readFromStream(), dlr::numeric::Array2D< Type >::row(), dlr::numeric::Stencil2D< Type, Size >::setPattern(), dlr::numeric::Stencil2D< Type, Size >::setTarget(), dlr::numeric::Array2D< Type >::shape(), dlr::numeric::shapeMatch(), dlr::numeric::squareRoot(), dlr::numeric::SubArray2D< Type >::SubArray2D(), dlr::numeric::Transform2D::Transform2D(), dlr::numeric::Transform3D::Transform3D(), and dlr::numeric::Transform3DTo2D::Transform3DTo2D().

template<class Type>
void dlr::numeric::Array2D< Type >::checkDimension ( size_t  rows,
size_t  columns 
) const [inline]

Optionally throw an exception if the shape of *this is different than specified.

Parameters:
rows The required number of rows.
columns The required number of columns.

Definition at line 1352 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns(), DLR_THROW, and dlr::numeric::Array2D< Type >::rows().

Referenced by dlr::numeric::operator==().

template<class Type>
Array2D< Type > dlr::numeric::Array2D< Type >::copy (  )  const [inline]

Allocates a new array and deep copies the contents of *this.

Returns:
A new array which is a (deep) copy of *this.

Definition at line 1371 of file array2D.h.

References dlr::numeric::Array2D< Type >::copy().

Referenced by dlr::numeric::Array2D< Type >::copy().

template<class Type>
template<class Type2>
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.

Parameters:
source The array to be copied.
Exceptions:
ValueException thrown when array sizes do not match.

Definition at line 1380 of file array2D.h.

References dlr::numeric::Array2D< Type >::copy(), dlr::numeric::Array2D< Type >::data(), DLR_THROW3, and dlr::numeric::Array2D< Type >::size().

template<class Type>
template<class Type2>
void dlr::numeric::Array2D< Type >::copy ( const Type2 *  dataPtr  )  [inline]

Copies elements from dataPtr.

There must be valid data at all addresses from dataPtr to (dataPtr + this->size());

Parameters:
dataPtr Pointer to the data to be copied.

Definition at line 1397 of file array2D.h.

References DLR_THROW.

template<class Type>
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.

Returns:
Pointer to the internal data store.

Definition at line 251 of file array2D.h.

Referenced by dlr::numeric::axisMaximum(), dlr::numeric::axisMinimum(), dlr::numeric::axisSum(), dlr::numeric::columnIndices(), 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::rowIndices(), and dlr::numeric::Stencil2D< Type, Size >::setTarget().

template<class Type>
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.

Returns:
Const pointer to the internal data store.

Definition at line 260 of file array2D.h.

template<class Type>
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" .

Parameters:
index Indicates to which element of the array the return value should point.
Returns:
Pointer to the (index)th element of the array.

Definition at line 273 of file array2D.h.

template<class Type>
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.

Parameters:
index Indicates to which element of the array the return value should point.
Returns:
Const pointer to the (index)th element of the array.

Definition at line 288 of file array2D.h.

template<class Type>
Type* dlr::numeric::Array2D< Type >::data ( size_t  row,
size_t  column 
) [inline]

Just like data(void), which is documented above, but returns a pointer to the element indexed by (row, column).

Parameters:
row The row of the element to which the return value should point.
column The column of the element to which the return value should point.
Returns:
Pointer to the selected element of the array.

Definition at line 306 of file array2D.h.

template<class Type>
const Type* dlr::numeric::Array2D< Type >::data ( size_t  row,
size_t  column 
) const [inline]

This version of data(size_t, size_t) is appropriate for const Array2D, and returns a pointer-to-const.

Parameters:
row The row of the element to which the return value should point.
column The column of the element to which the return value should point.
Returns:
Const pointer to the selected element of the array.

Definition at line 323 of file array2D.h.

template<class Type>
bool dlr::numeric::Array2D< Type >::empty (  )  const [inline]

This member function returns true if the array instance contains no elements.

It has complexity O(1).

Returns:
The return value indicates whether or not the array is empty.

Definition at line 337 of file array2D.h.

template<class Type>
iterator dlr::numeric::Array2D< Type >::end (  )  [inline]

Return end() iterator for Standard Library algorithms.

Returns:
Iterator pointing just past the last element of the array.

Definition at line 347 of file array2D.h.

Referenced by dlr::numeric::abs(), dlr::numeric::logicalNot(), 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().

template<class Type>
const_iterator dlr::numeric::Array2D< Type >::end (  )  const [inline]

Return end() const_iterator for Standard Library algorithms.

Returns:
Const iterator pointing just past the last element of the array.

Definition at line 357 of file array2D.h.

template<class Type>
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.

Returns:
The return value is a bool indicating whether the internal data requires memory management.

Definition at line 369 of file array2D.h.

template<class Type>
Array1D< Type > dlr::numeric::Array2D< Type >::ravel (  )  [inline]

Returns an Array1D, with size equal to this->size(), which references the same data as *this.

In other words, ravel() returns a flattened version of *this.

Returns:
Array1D referencing the same data as *this.

Definition at line 1420 of file array2D.h.

Referenced by dlr::numeric::ravel().

template<class Type>
const Array1D< Type > dlr::numeric::Array2D< Type >::ravel (  )  const [inline]

Returns a const Array1D, with size equal to this->size(), which references the same data as *this.

In other words, ravel() returns a flattened version of *this.

Returns:
Array1D referencing the same data as *this.

Definition at line 1410 of file array2D.h.

template<class Type>
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.

Parameters:
inputStream This is the stream from which to read the array.
Returns:
The return value is a reference to inputStream.

Definition at line 1432 of file array2D.h.

References dlr::numeric::Array2D< Type >::begin(), dlr::numeric::Array1D< Type >::clear(), dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::end(), dlr::numeric::Array2D< Type >::reinit(), dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().

Referenced by dlr::numeric::operator>>().

template<class Type>
size_t* dlr::numeric::Array2D< Type >::refCountPtr (  )  const [inline]

Temporary function to ease porting of code from early versions of dlr_libs.

The use of this function is discouraged.

Returns:
The return value is a pointer to the internal reference count.

Definition at line 416 of file array2D.h.

template<class Type>
void dlr::numeric::Array2D< Type >::reinit ( size_t  rows,
size_t  columns 
) [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 rows x columns.

Parameters:
rows Requested row dimension.
columns Requested column dimension.

Definition at line 1525 of file array2D.h.

Referenced by dlr::numeric::Array2D< TYPE >::clear(), dlr::numeric::getMeanAndCovariance(), and dlr::numeric::Array2D< Type >::readFromStream().

template<class Type>
void dlr::numeric::Array2D< Type >::reshape ( int  rows,
int  columns 
) [inline]

Changes the shape of the array.

It is an error if rows * columns is not equal to this->size(). Either rows or columns 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.

Parameters:
rows Requested row dimension.
columns Requested column dimension.
Exceptions:
ValueException thrown when old and new array sizes do not match.

Definition at line 1537 of file array2D.h.

References DLR_THROW, and dlr::numeric::Array2D< Type >::size().

template<class Type>
Array1D< Type > dlr::numeric::Array2D< Type >::row ( 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.

Parameters:
index Specifies which row to reference.
Returns:
An Array1D instance referencing the selected row.

Definition at line 1561 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns().

Referenced by dlr::numeric::matrixMultiply(), and dlr::numeric::BSpline< Type >::operator()().

template<class Type>
const Array1D< Type > dlr::numeric::Array2D< Type >::row ( 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.

Parameters:
index Specifies which row to reference.
Returns:
An Array1D instance referencing the selected row.

Definition at line 1571 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns().

template<class Type>
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.

Parameters:
rowIndex Specifies which row if the array should be referenced. Row 0 is the top row.
Returns:
Iterator pointing to the first element of the specified row of the Array2D instance.

Definition at line 486 of file array2D.h.

Referenced by dlr::numeric::sum().

template<class Type>
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.

Parameters:
rowIndex Specifies which row if the array should be referenced. Row 0 is the top row.
Returns:
Const iterator pointing to the first element of the specified row of the Array2D instance.

Definition at line 500 of file array2D.h.

template<class Type>
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.

Parameters:
rowIndex Specifies which row if the array should be referenced. Row 0 is the top row.
Returns:
Iterator pointing one element past the end of the specified row.

Definition at line 516 of file array2D.h.

template<class Type>
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.

Parameters:
rowIndex Specifies which row if the array should be referenced. Row 0 is the top row.
Returns:
Const iterator pointing one element past the end of the specified row.

Definition at line 532 of file array2D.h.

template<class Type>
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.

Returns:
Number of rows.

Definition at line 545 of file array2D.h.

Referenced by dlr::numeric::abs(), dlr::numeric::axisMaximum(), dlr::numeric::axisMinimum(), dlr::numeric::axisSum(), dlr::numeric::Array2D< Type >::checkDimension(), dlr::numeric::correlate2D(), dlr::numeric::getMeanAndCovariance(), dlr::numeric::logicalNot(), dlr::numeric::matrixMultiply(), 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 >::readFromStream(), dlr::numeric::Stencil2D< Type, Size >::setPattern(), dlr::numeric::Stencil2D< Type, Size >::setTarget(), dlr::numeric::Array2D< Type >::shape(), dlr::numeric::shapeMatch(), dlr::numeric::squareRoot(), dlr::numeric::SubArray2D< Type >::SubArray2D(), dlr::numeric::Transform2D::Transform2D(), dlr::numeric::Transform3D::Transform3D(), and dlr::numeric::Transform3DTo2D::Transform3DTo2D().

template<class Type>
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().

Returns:
Array describing the shape of *this.

Definition at line 1581 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns(), and dlr::numeric::Array2D< Type >::rows().

Referenced by dlr::numeric::Array2D< Type >::shape().

template<class Type>
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.

Parameters:
axis Selected axis.
Exceptions:
ValueException thrown on invalid axis parameter.
Returns:
Dimension along the selected axis.

Definition at line 1592 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns(), DLR_THROW, dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::shape().

template<class Type>
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().

Returns:
Number of elements.

Definition at line 579 of file array2D.h.

Referenced by dlr::numeric::Array2D< Type >::copy(), dlr::numeric::Array2D< TYPE >::empty(), dlr::numeric::getMeanAndCovariance(), dlr::numeric::ln(), 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 >::reshape(), and dlr::numeric::Stencil2D< Type, Size >::setTarget().

template<class Type>
Array2D< Type > dlr::numeric::Array2D< Type >::transpose (  )  const [inline]

Compute matrix transpose.

The resulting array does not reference the same memory as *this.

Returns:
Transposed copy of *this.

Definition at line 1770 of file array2D.h.

References dlr::numeric::Array2D< Type >::m_dataPtr.

template<class Type>
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.

Parameters:
source The Array2D instance to be copied.
Returns:
Reference to *this.

Definition at line 1625 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.

template<class Type>
Array2D< Type > & dlr::numeric::Array2D< Type >::operator= ( Type  value  )  [inline]

Assign value to every element in the array.

Parameters:
value The value to be copied.
Returns:
Reference to *this.

Definition at line 1616 of file array2D.h.

template<class Type>
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.

Parameters:
index Indicates the selected element.
Returns:
Reference to the (index)th element of the array.

Definition at line 620 of file array2D.h.

Referenced by dlr::numeric::Array2D< TYPE >::operator[]().

template<class Type>
Type dlr::numeric::Array2D< Type >::operator() ( size_t  index  )  const [inline]

Returns the (index)th element of the array by value.

Elements are indexed in row-major order.

Returns:
Value of the (index)th element of the array.

Definition at line 631 of file array2D.h.

template<class Type>
Type& dlr::numeric::Array2D< Type >::operator() ( size_t  row,
size_t  column 
) [inline]

Returns a specific element of the array by reference.

Parameters:
row Row of the selected element.
column Column of the selected element.
Returns:
Reference to the array element.

Definition at line 646 of file array2D.h.

template<class Type>
Type dlr::numeric::Array2D< Type >::operator() ( size_t  row,
size_t  column 
) const [inline]

Returns a specific element of the array by value.

Parameters:
row Row of the selected element.
column Column of the selected element.
Returns:
Value of the array element.

Definition at line 661 of file array2D.h.

template<class Type>
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).

Parameters:
index Indicates the selected element.
Returns:
Reference to the (index)th element of the array.

Definition at line 675 of file array2D.h.

template<class Type>
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.

Parameters:
index Indicates the selected element.
Returns:
Value of the (index)th element of the array.

Definition at line 686 of file array2D.h.

template<class Type>
template<class Type2>
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.

Parameters:
arg Array2D of values to be added to the elements of *this.
Exceptions:
ValueException thrown when array sizes differ.
Returns:
Reference to *this.

Definition at line 1647 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::data(), DLR_THROW, dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().

template<class Type>
template<class Type2>
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.

Parameters:
arg Array2D of values to be subtracted from the elements of *this.
Exceptions:
ValueException thrown when array sizes differ.
Returns:
Reference to *this.

Definition at line 1667 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::data(), DLR_THROW, dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().

template<class Type>
template<class Type2>
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.

Parameters:
arg Array2D of values by which the elements of *this are to be multiplied.
Exceptions:
ValueException thrown when array sizes differ.
Returns:
Reference to *this.

Definition at line 1687 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::data(), DLR_THROW, dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().

template<class Type>
template<class Type2>
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.

Parameters:
arg Array2D of values by which the elements of *this are to be divided.
Exceptions:
ValueException thrown when array sizes differ.
Returns:
Reference to *this.

Definition at line 1707 of file array2D.h.

References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::data(), DLR_THROW, dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Array2D< Type >::size().

template<class Type>
Array2D< Type > & dlr::numeric::Array2D< Type >::operator+= ( Type  arg  )  [inline]

Increments each element of *this by a constant.

Parameters:
arg Value by which array elements will be incremented.
Returns:
Reference to *this.

Definition at line 1749 of file array2D.h.

template<class Type>
Array2D< Type > & dlr::numeric::Array2D< Type >::operator-= ( Type  arg  )  [inline]

Decrements each element of *this by a constant.

Parameters:
arg Value by which array elements will be decremented.
Returns:
Reference to *this.

Definition at line 1760 of file array2D.h.

template<class Type>
Array2D< Type > & dlr::numeric::Array2D< Type >::operator *= ( Type  arg  )  [inline]

Multiplies each element of *this by a constant.

Parameters:
arg Value by which array elements will be multiplied.
Returns:
Reference to *this.

Definition at line 1727 of file array2D.h.

template<class Type>
Array2D< Type > & dlr::numeric::Array2D< Type >::operator/= ( Type  arg  )  [inline]

Divides each element of *this by a constant.

Parameters:
arg Value by which array elements will be divided.
Returns:
Reference to *this.

Definition at line 1738 of file array2D.h.


The documentation for this class was generated from the following file:
Generated on Mon Jul 9 20:34:21 2007 for dlrLibs Utility Libraries by  doxygen 1.5.2