dlr::numeric::ArrayND< Dimension, Type > Class Template Reference

#include <arrayND.h>

Collaboration diagram for dlr::numeric::ArrayND< Dimension, Type >:
[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

 ArrayND ()
 Default constructor initializes to zero size.
 ArrayND (size_t dimension, size_t const shape[])
 Constructs an array with a user-specified shape.
 ArrayND (const Array1D< size_t > &shape)
 Constructs an array with a user-specified shape.
 ArrayND (const ArrayND< Dimension, Type > &source)
 The copy constructor does a shallow copy.
 ArrayND (const std::string &inputString)
 Construct from an initialization string.
 ~ArrayND ()
 Destroys the ArrayND 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 checkDimension (Array1D< size_t > const &shape) const
 Optionally throw an exception if the shape of *this is different than specified.
void clear ()
 Reset the array to zero size, abandoning all contents.
ArrayND< Dimension, Type > copy () const
 Allocate a new array and deep copy the contents of *this.
template<class Type2 >
void copy (const ArrayND< Dimension, 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 ArrayND, 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.
size_t flattenIndex (const Array1D< size_t > &indexArray) const
 This member function converts a multi-dimensional index (such as would be passed to getElement(Array1D<size_t> const&)) into a scalar index (such as would be passed to getElement(size_t).
Type getElement (size_t index0) const
 This member function returns a specific element of the array by value.
Type getElement (Array1D< size_t > const &index0) const
 This member function returns a specific element of the array by value.
const Array1D< size_t > & getShape () const
 This member function returns a (reference to an) array describing the shape of *this.
size_t getStride (size_t axis) const
 This member function establishes the relationship between single-indexing (for example using getElement(size_t)) and array indexing (for example using getElement(Array1D<size_t> const&)) by returning the single-index offset between adjacent elements along the specified axis.
Array1D< size_t > const & getStrideArray () const
 This member function returns an array in which each element contains the distance between adjacent elements along the corresponding axis.
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.
Array1D< Type > const ravel () const
 Returns an Array1D, with size equal to this->size(), which references the same data as *this.
void reinit (Array1D< size_t > const &shape)
 Changes the shape of the array and reallocates storage.
Type & setElement (size_t index0, const Type &value)
 This member function sets the value of a specific element of the array.
Type & setElement (Array1D< size_t > const &index0, const Type &value)
 This member function sets the value of a specific element of the array.
size_t size () const
 Returns the number of elements in the array.
ArrayND< Dimension, Type > & operator= (const ArrayND< Dimension, Type > &source)
 Assignment operator shallow copies the contents of source.
ArrayND< Dimension, Type > & operator= (Type value)
 Assign value to every element in the array.
Type & operator() (size_t index0)
 Returns the (index)th element of the array by reference.
Type operator() (size_t index0) const
 Returns the (index)th element of the array by value.
Type & operator() (Array1D< size_t > const &index0)
 Returns the (index)th element of the array by reference.
Type operator() (Array1D< size_t > const &index0) const
 Returns the (index)th 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 >
ArrayND< Dimension, Type > & operator+= (const ArrayND< Dimension, Type2 > &arg)
 Increments each element of *this by the value of the corresponding element of arg.
ArrayND< Dimension, Type > & operator+= (const Type arg)
 Increments each element of *this by a constant.
template<class Type2 >
ArrayND< Dimension, Type > & operator-= (const ArrayND< Dimension, Type2 > &arg)
 Decrements each element of *this by the value of the corresponding element of arg.
ArrayND< Dimension, Type > & operator-= (const Type arg)
 Decrements each element of *this by a constant.
template<class Type2 >
ArrayND< Dimension, Type > & operator*= (const ArrayND< Dimension, Type2 > &arg)
 Multiplies each element of *this by the value of the corresponding element of arg.
ArrayND< Dimension, Type > & operator*= (const Type arg)
 Multiplies each element of *this by a constant.
template<class Type2 >
ArrayND< Dimension, Type > & operator/= (const ArrayND< Dimension, Type2 > &arg)
 Divides each element of *this by the value of the corresponding element of arg.
ArrayND< Dimension, Type > & operator/= (const Type arg)
 Divides each element of *this by a constant.


Detailed Description

template<size_t Dimension, class Type>
class dlr::numeric::ArrayND< Dimension, Type >

Warning:
WARNING: this class is very immature, is not well tested, and has an interface that is subject to change.
The ArrayND class template represents a multi-dimensional array of arbitrary type. This class has internal reference counting.

Element storage in the ArrayND class is contiguous along the last axis, then the next-to-last axis, etc. To make this clearer, you can think of the 2-dimensional array in the example below as having 3 rows and 4 columns, with the elements stored in raster order, starting from the top-left corner of the array.

   size_t const shape[] = {3, 4};
   ArrayND<2, int> exampleArray3x4(shape);

In the current implementation, there is no provision for padding between rows of the array (for example, to align on 16-byte boundaries). We may add support for this later, however the default behavior will always be to have no padding unless it is explicitly enabled. If your code counts on contiguous storage in an ArrayND instance passed in from code you do not control, you can make sure there's no padding by confirming that the isContiguous() method returns true.

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 73 of file arrayND.h.


Member Typedef Documentation

template<size_t Dimension, class Type>
typedef const Type* dlr::numeric::ArrayND< Dimension, Type >::const_iterator

Typedef for const_iterator type helps with standard library interface.

Definition at line 91 of file arrayND.h.

template<size_t Dimension, class Type>
typedef Type* dlr::numeric::ArrayND< Dimension, Type >::iterator

Typedef for iterator type helps with standard library interface.

Definition at line 85 of file arrayND.h.

template<size_t Dimension, class Type>
typedef Type dlr::numeric::ArrayND< Dimension, Type >::value_type

Typedef for value_type describes the contents of the array.

Definition at line 80 of file arrayND.h.


Constructor & Destructor Documentation

template<size_t Dimension, class Type >
dlr::numeric::ArrayND< Dimension, Type >::ArrayND (  )  [inline]

Default constructor initializes to zero size.

Definition at line 1038 of file arrayND.h.

template<size_t Dimension, class Type >
dlr::numeric::ArrayND< Dimension, Type >::ArrayND ( size_t  dimension,
size_t const   shape[] 
) [inline, explicit]

Constructs an array with a user-specified shape.

For example, the following code constructs a 2-dimensional ArrayND instance with 5 rows and 6 columns:

   size_t shape[] = {5, 6};
   ArrayND<2, int> myArray(2, shape);

Here's a second example, which creates a 3-dimensional ArrayND instance with 2 levels of 5 rows and 6 columns:

   size_t const shape[] = {2, 5, 6};
   ArrayND<3, int> myArray(3, shape);

Parameters:
dimension This argument specifies the dimension (number of axes) in the array. Set this to 1 if you want a vector, 2 if you want a matrix, 3 if you want a 3D array, etc.
shape This array specifies the size (number of elements along each axis) of the new ArrayND instance.

Definition at line 1049 of file arrayND.h.

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

template<size_t Dimension, class Type >
dlr::numeric::ArrayND< Dimension, Type >::ArrayND ( const Array1D< size_t > &  shape  )  [inline, explicit]

Constructs an array with a user-specified shape.

For example, the following code constructs a 2-dimensional ArrayND instance with 5 rows and 6 columns:

   ArrayND<2, int> myArray(Array1D<size_t>("[5, 6]"));

Here's a second example, which creates a 3-dimensional ArrayND instance with 2 levels of 5 rows and 6 columns:

   ArrayND<3, int> myArray(Array1D<size_t>("[2, 5, 6]"));

Parameters:
shape This array specifies the size (number of elements along each axis) of the new ArrayND instance.

Definition at line 1062 of file arrayND.h.

template<size_t Dimension, class Type >
dlr::numeric::ArrayND< Dimension, Type >::ArrayND ( const ArrayND< Dimension, 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 ArrayND<> instance to be copied.

Definition at line 1076 of file arrayND.h.

template<size_t Dimension, class Type >
dlr::numeric::ArrayND< Dimension, Type >::ArrayND ( const std::string &  inputString  )  [inline, explicit]

Construct from an initialization string.

Ultimately, this constructor will be very flexible about interpreting string syntax, but right now it only accepts a secret format known only to the developers of this library.

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

Definition at line 1088 of file arrayND.h.

template<size_t Dimension, class Type >
dlr::numeric::ArrayND< Dimension, Type >::~ArrayND (  )  [inline]

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

Definition at line 1101 of file arrayND.h.


Member Function Documentation

template<size_t Dimension, class Type>
const_iterator dlr::numeric::ArrayND< Dimension, 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 200 of file arrayND.h.

template<size_t Dimension, class Type>
iterator dlr::numeric::ArrayND< Dimension, Type >::begin (  )  [inline]

Return begin() iterator for Standard Library algorithms.

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

Definition at line 190 of file arrayND.h.

Referenced by dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator==(), dlr::numeric::operator>(), and dlr::numeric::operator>=().

template<size_t Dimension, class Type >
void dlr::numeric::ArrayND< Dimension, Type >::checkDimension ( Array1D< size_t > const &  shape  )  const [inline]

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

Parameters:
size The required array size.

Definition at line 1109 of file arrayND.h.

References dlr::numeric::Array1D< Type >::size().

Referenced by dlr::numeric::ArrayND< Dimension, Type >::copy(), and dlr::numeric::operator==().

template<size_t Dimension, class Type>
void dlr::numeric::ArrayND< Dimension, Type >::clear (  )  [inline]

Reset the array to zero size, abandoning all contents.

This is equivalent to this->reinit(0);

Definition at line 218 of file arrayND.h.

References dlr::numeric::Array1D< Type >::reinit().

template<size_t Dimension, class Type >
template<class Type2 >
void dlr::numeric::ArrayND< Dimension, 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 1158 of file arrayND.h.

template<size_t Dimension, class Type >
template<class Type2 >
void dlr::numeric::ArrayND< Dimension, Type >::copy ( const ArrayND< Dimension, Type2 > &  source  )  [inline]

Deep copies the contents of source.

It is an error if source does not have the same shape as *this.

Parameters:
source The array to be copied.
Exceptions:
ValueException on incompatible array sizes
See also:
void ArrayND<size_t, Type>::copy(const Type2* dataPtr)

Definition at line 1146 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::checkDimension(), dlr::numeric::ArrayND< Dimension, Type >::copy(), dlr::numeric::ArrayND< Dimension, Type >::data(), and dlr::numeric::ArrayND< Dimension, Type >::getShape().

template<size_t Dimension, class Type >
ArrayND< Dimension, Type > dlr::numeric::ArrayND< Dimension, Type >::copy (  )  const [inline]

Allocate a new array and deep copy the contents of *this.

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

Definition at line 1136 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::copy().

Referenced by dlr::numeric::ArrayND< Dimension, Type >::copy().

template<size_t Dimension, class Type>
const Type* dlr::numeric::ArrayND< Dimension, Type >::data ( void   )  const [inline]

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

Returns:
Const pointer to the internal data store.
See also:
Type* ArrayND<size_t, Type>::data()

Definition at line 278 of file arrayND.h.

template<size_t Dimension, class Type>
Type* dlr::numeric::ArrayND< Dimension, Type >::data ( void   )  [inline]

Returns a pointer to the internal data store.

This is ugly but often necessary for interfacing with external libraries. In the current implementation, data is stored contiguously. At some point, we may add support for padding to byte-align subsequent rows. In this event, any ArrayND instance for which the returned data is not contiguous will also return false from member function isContiguous().

Returns:
Pointer to the internal data store.

Definition at line 266 of file arrayND.h.

Referenced by dlr::numeric::ArrayND< Dimension, Type >::copy().

template<size_t Dimension, class Type>
bool dlr::numeric::ArrayND< Dimension, 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 289 of file arrayND.h.

template<size_t Dimension, class Type>
const_iterator dlr::numeric::ArrayND< Dimension, 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 309 of file arrayND.h.

template<size_t Dimension, class Type>
iterator dlr::numeric::ArrayND< Dimension, Type >::end (  )  [inline]

Return end() iterator for Standard Library algorithms.

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

Definition at line 299 of file arrayND.h.

Referenced by dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator==(), dlr::numeric::operator>(), and dlr::numeric::operator>=().

template<size_t Dimension, class Type >
size_t dlr::numeric::ArrayND< Dimension, Type >::flattenIndex ( const Array1D< size_t > &  indexArray  )  const [inline]

This member function converts a multi-dimensional index (such as would be passed to getElement(Array1D<size_t> const&)) into a scalar index (such as would be passed to getElement(size_t).

Parameters:
indexArray This argument is the array to be converted.
Returns:
The return value is the equivalent 1D index.

Definition at line 1177 of file arrayND.h.

References dlr::numeric::Array1D< Type >::begin(), and dlr::numeric::Array1D< Type >::end().

Referenced by dlr::numeric::convolve(), dlr::numeric::ArrayND< Dimension, Type >::operator()(), and dlr::numeric::ArrayND< Dimension, Type >::setElement().

template<size_t Dimension, class Type>
Type dlr::numeric::ArrayND< Dimension, Type >::getElement ( Array1D< size_t > const &  index0  )  const [inline]

This member function returns a specific element of the array by value.

Parameters:
index0 This argument specifies which element value should be returned.
Returns:
The return value is a copy of the requested element.

Definition at line 349 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::operator()().

template<size_t Dimension, class Type>
Type dlr::numeric::ArrayND< Dimension, Type >::getElement ( size_t  index0  )  const [inline]

This member function returns a specific element of the array by value.

Parameters:
index0 This argument specifies which element value should be returned.
Returns:
The return value is a copy of the requested element.

Definition at line 336 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::operator()().

template<size_t Dimension, class Type>
const Array1D<size_t>& dlr::numeric::ArrayND< Dimension, Type >::getShape (  )  const [inline]

This member function returns a (reference to an) array describing the shape of *this.

Note that Array1D copy semantics are _shallow_, so you'll actually get an array that references memory inside *this. If you copy (shallow copy) this array, and then modify its contents, you will break the internal state of *this.

Returns:
The return value is an array describing the number of elements along each axis of *this.

Definition at line 366 of file arrayND.h.

Referenced by dlr::numeric::convolve(), dlr::numeric::ArrayND< Dimension, Type >::copy(), dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator==(), dlr::numeric::operator>(), and dlr::numeric::operator>=().

template<size_t Dimension, class Type>
size_t dlr::numeric::ArrayND< Dimension, Type >::getStride ( size_t  axis  )  const [inline]

This member function establishes the relationship between single-indexing (for example using getElement(size_t)) and array indexing (for example using getElement(Array1D<size_t> const&)) by returning the single-index offset between adjacent elements along the specified axis.

Parameters:
axis This argument specifies the axis along which we wish to move.
Returns:
The return value is the number by which the argument to getElement(size_t) must be incremented in order to move one element along the specified axis.

Definition at line 384 of file arrayND.h.

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

template<size_t Dimension, class Type>
Array1D<size_t> const& dlr::numeric::ArrayND< Dimension, Type >::getStrideArray (  )  const [inline]

This member function returns an array in which each element contains the distance between adjacent elements along the corresponding axis.

See member function getStride() for more information. Note that Array1D copy semantics are _shallow_, so you'll actually get an array that references memory inside *this. If you copy (shallow copy) this array, and then modify its contents, you will break the internal state of *this.

Returns:
The return value is an array in which the ii-th element is equal to the result of this->getStride(ii).

Definition at line 401 of file arrayND.h.

template<size_t Dimension, class Type>
bool dlr::numeric::ArrayND< Dimension, 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 is being managed by *this.

Definition at line 413 of file arrayND.h.

template<size_t Dimension, class Type>
Type dlr::numeric::ArrayND< Dimension, Type >::operator() ( Array1D< size_t > const &  index0  )  const [inline]

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

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

Definition at line 559 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::flattenIndex().

template<size_t Dimension, class Type>
Type& dlr::numeric::ArrayND< Dimension, Type >::operator() ( Array1D< size_t > const &  index0  )  [inline]

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

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

Definition at line 547 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::flattenIndex().

template<size_t Dimension, class Type>
Type dlr::numeric::ArrayND< Dimension, Type >::operator() ( size_t  index0  )  const [inline]

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

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

Definition at line 536 of file arrayND.h.

template<size_t Dimension, class Type>
Type& dlr::numeric::ArrayND< Dimension, Type >::operator() ( size_t  index0  )  [inline]

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

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

Definition at line 526 of file arrayND.h.

Referenced by dlr::numeric::ArrayND< Dimension, Type >::getElement(), dlr::numeric::ArrayND< Dimension, Type >::operator[](), and dlr::numeric::ArrayND< Dimension, Type >::setElement().

template<size_t Dimension, class Type >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator*= ( const 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 1266 of file arrayND.h.

template<size_t Dimension, class Type >
template<class Type2 >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator*= ( const ArrayND< Dimension, Type2 > &  arg  )  [inline]

Multiplies each element of *this by the value of the corresponding element of arg.

Parameters:
arg ArrayND of values by which the elements of *this should be multiplied.
Exceptions:
ValueException on incompatible array sizes
Returns:
Reference to *this.

Definition at line 1255 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::m_storage.

template<size_t Dimension, class Type >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator+= ( const 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 1224 of file arrayND.h.

template<size_t Dimension, class Type >
template<class Type2 >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator+= ( const ArrayND< Dimension, Type2 > &  arg  )  [inline]

Increments each element of *this by the value of the corresponding element of arg.

Parameters:
arg ArrayND of values to be added to the elements of *this.
Exceptions:
ValueException on incompatible array sizes
Returns:
Reference to *this.

Definition at line 1213 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::m_storage.

template<size_t Dimension, class Type >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator-= ( const 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 1245 of file arrayND.h.

template<size_t Dimension, class Type >
template<class Type2 >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator-= ( const ArrayND< Dimension, Type2 > &  arg  )  [inline]

Decrements each element of *this by the value of the corresponding element of arg.

Parameters:
arg ArrayND of values to be subtracted from the elements of *this.
Exceptions:
ValueException on incompatible array sizes
Returns:
Reference to *this.

Definition at line 1234 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::m_storage.

template<size_t Dimension, class Type >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator/= ( const 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 1287 of file arrayND.h.

template<size_t Dimension, class Type >
template<class Type2 >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator/= ( const ArrayND< Dimension, Type2 > &  arg  )  [inline]

Divides each element of *this by the value of the corresponding element of arg.

Parameters:
arg ArrayND of values by which the elements of *this should be divided.
Exceptions:
ValueException on incompatible array sizes
Returns:
Reference to *this.

Definition at line 1276 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::m_storage.

template<size_t Dimension, class Type >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, 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 1167 of file arrayND.h.

template<size_t Dimension, class Type >
ArrayND< Dimension, Type > & dlr::numeric::ArrayND< Dimension, Type >::operator= ( const ArrayND< Dimension, Type > &  source  )  [inline]

Assignment operator shallow copies the contents of source.

After the copy, both arrays reference the same data.

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

Definition at line 1198 of file arrayND.h.

References dlr::numeric::Array1D< Type >::copy(), dlr::numeric::ArrayND< Dimension, Type >::m_shape, dlr::numeric::ArrayND< Dimension, Type >::m_storage, and dlr::numeric::ArrayND< Dimension, Type >::m_strideArray.

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

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

Synonymous with operator()() const.

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

Definition at line 583 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::operator()().

template<size_t Dimension, class Type>
Type& dlr::numeric::ArrayND< Dimension, Type >::operator[] ( size_t  index  )  [inline]

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

Synonymous with operator()().

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

Definition at line 572 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::operator()().

template<size_t Dimension, class Type>
Array1D<Type> const dlr::numeric::ArrayND< Dimension, Type >::ravel (  )  const [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 435 of file arrayND.h.

template<size_t Dimension, class Type>
Array1D<Type> dlr::numeric::ArrayND< Dimension, 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 424 of file arrayND.h.

template<size_t Dimension, class Type >
void dlr::numeric::ArrayND< Dimension, Type >::reinit ( Array1D< size_t > const &  shape  )  [inline]

Changes the shape of the array and reallocates storage.

The current array contents are lost.

Parameters:
size Number of elements in the array after reallocation.

Definition at line 1188 of file arrayND.h.

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

template<size_t Dimension, class Type>
Type& dlr::numeric::ArrayND< Dimension, Type >::setElement ( Array1D< size_t > const &  index0,
const Type &  value 
) [inline]

This member function sets the value of a specific element of the array.

Parameters:
index0 This argument specifies which element value should be set.
value This argument will be copied into the selected array element.
Returns:
The return value is a reference to the newly set array element.

Definition at line 481 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::flattenIndex(), and dlr::numeric::ArrayND< Dimension, Type >::operator()().

template<size_t Dimension, class Type>
Type& dlr::numeric::ArrayND< Dimension, Type >::setElement ( size_t  index0,
const Type &  value 
) [inline]

This member function sets the value of a specific element of the array.

Parameters:
index0 This argument specifies which element value should be set.
value This argument will be copied into the selected array element.
Returns:
The return value is a reference to the newly set array element.

Definition at line 462 of file arrayND.h.

References dlr::numeric::ArrayND< Dimension, Type >::operator()().

template<size_t Dimension, class Type>
size_t dlr::numeric::ArrayND< Dimension, Type >::size (  )  const [inline]

Returns the number of elements in the array.

Returns:
The number of elements in the array.

Definition at line 492 of file arrayND.h.

Referenced by dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), and dlr::numeric::operator/().


The documentation for this class was generated from the following file:

Generated on Wed Nov 25 00:42:48 2009 for dlrUtilities Utility Library by  doxygen 1.5.8