Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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>.

Here is the call graph for this function:

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 void   )  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 Fri Sep 16 11:09:13 2005 for spuc by  doxygen 1.4.4