#include <array.h>
Collaboration diagram for SPUC::Array< T >:
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. | |
T | 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>. | |
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. | |
T | 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. |
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;
|
Default constructor.
|
|
Create an Array of size
|
|
Create a copy of
|
|
Default destructor.
|
|
Returns the number of data elements in the array object.
|
|
Sub-array with the elements given by the integer Array.
Here is the call graph for this function: |
|
Sub-array from element
|
|
Get the
|
|
Get the
|
|
Assignment operator.
Here is the call graph for this function: |
|
Assignment operator.
|
|
Resizing an Array<T>.
Here is the call graph for this function: |
|
Resizing an Array<T>.
|
|
Set the subarray defined by indicies i1 to i2 the element value t.
|
|
Set the subarray defined by indicies i1 to i2 to Array<T> a.
|
|
Shift in array at position Ndata()-1. return data at last position.
|
|
Shift in data at position Ndata()-1. return data at last position.
|
|
Shift in array at position 0. return data at last position.
|
|
Shift in data at position 0. return data at last position.
|
|
Returns the number of data elements in the array object.
|
|
Swap elements i and j.
|