SPUC::array< T > Class Template Reference

General array class. More...

#include <array.h>

Collaboration diagram for SPUC::array< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 array ()
 Default constructor.
 array (int n)
 Create an array of size n.
 array (const array< T > &a)
 Create a copy of a.
virtual ~array ()
 Default destructor.
T & operator() (int i)
 Get the i element.
operator() (int i) const
 Get the i element.
array< T > operator() (int i1, int i2) const
 Sub-array from element i1 to element i2.
array< T > operator() (const array< int > &indices) const
 Sub-array with the elements given by the integer array.
void operator= (T e)
 Assignment operator.
void operator= (const array< T > &a)
 Assignment operator.
int size () const
 Returns the number of data elements in the array object.
int length () const
 Returns the number of data elements in the array object.
void set_size (int n, bool copy=false)
 Resizing an array<T>.
void set_length (int n, bool copy=false)
 Resizing an array<T>.
shift_right (T e)
 Shift in data at position 0. return data at last position.
array< T > shift_right (const array< T > &a)
 Shift in array at position 0. return data at last position.
shift_left (T e)
 Shift in data at position Ndata()-1. return data at last position.
array< T > shift_left (const array< T > &a)
 Shift in array at position Ndata()-1. return data at last position.
void swap (int i, int j)
 Swap elements i and j.
void set_subarray (int i1, int i2, const array< T > &a)
 Set the subarray defined by indicies i1 to i2 to array<T> a.
void set_subarray (int i1, int i2, const T t)
 Set the subarray defined by indicies i1 to i2 the element value t.

Detailed Description

template<class T>
class SPUC::array< T >

General array class.

This class is a general linear array class for arbitrary types. The operations and functions are the same as for the vector Vec class (except for the arithmetics).

For rarely used types you will need to instantiate the class by

  template class array<type>;

The following example shows how to define an array of vectors:

  vec a = randn(10);
  vec b = randn(20);
  vec c = randn(30);
  array<vec> my_array(3);
  my_array(0) = a;
  my_array(1) = b;
  my_array(2) = c;


Constructor & Destructor Documentation

template<class T>
SPUC::array< T >::array (  ) 

Default constructor.

template<class T>
SPUC::array< T >::array ( int  n  ) 

Create an array of size n.

template<class T>
SPUC::array< T >::array ( const array< T > &  a  ) 

Create a copy of a.

template<class T>
SPUC::array< T >::~array (  )  [virtual]

Default destructor.


Member Function Documentation

template<class T>
int SPUC::array< T >::length (  )  const [inline]

Returns the number of data elements in the array object.

template<class T>
array< T > SPUC::array< T >::operator() ( const array< int > &  indices  )  const

Sub-array with the elements given by the integer array.

template<class T>
array< T > SPUC::array< T >::operator() ( int  i1,
int  i2 
) const

Sub-array from element i1 to element i2.

template<class T>
T SPUC::array< T >::operator() ( int  i  )  const [inline]

Get the i element.

template<class T>
T& SPUC::array< T >::operator() ( int  i  )  [inline]

Get the i element.

template<class T>
void SPUC::array< T >::operator= ( const array< T > &  a  ) 

Assignment operator.

template<class T>
void SPUC::array< T >::operator= ( e  ) 

Assignment operator.

template<class T>
void SPUC::array< T >::set_length ( int  n,
bool  copy = false 
) [inline]

Resizing an array<T>.

template<class T>
void SPUC::array< T >::set_size ( int  n,
bool  copy = false 
)

Resizing an array<T>.

template<class T>
void SPUC::array< T >::set_subarray ( int  i1,
int  i2,
const T  t 
)

Set the subarray defined by indicies i1 to i2 the element value t.

template<class T>
void SPUC::array< T >::set_subarray ( int  i1,
int  i2,
const array< T > &  a 
)

Set the subarray defined by indicies i1 to i2 to array<T> a.

template<class T>
array< T > SPUC::array< T >::shift_left ( const array< T > &  a  ) 

Shift in array at position Ndata()-1. return data at last position.

template<class T>
T SPUC::array< T >::shift_left ( e  ) 

Shift in data at position Ndata()-1. return data at last position.

template<class T>
array< T > SPUC::array< T >::shift_right ( const array< T > &  a  ) 

Shift in array at position 0. return data at last position.

template<class T>
T SPUC::array< T >::shift_right ( e  ) 

Shift in data at position 0. return data at last position.

template<class T>
int SPUC::array< T >::size (  )  const [inline]

Returns the number of data elements in the array object.

template<class T>
void SPUC::array< T >::swap ( int  i,
int  j 
)

Swap elements i and j.


The documentation for this class was generated from the following file:
Generated on Mon Jun 9 19:40:31 2008 for DSPTemplates by  doxygen 1.4.7