Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

xchen::TensorArray< T, dims > Class Template Reference

A multi-array, with the same shape in each direction. More...

#include <TensorArray.H>

List of all members.

Public Methods

 TensorArray ()
 construct an empty tensor array.

 TensorArray (int sz,...)
 1st arg is array size in dimension 'dims-1'. Assuming list has 'dims' args.

 TensorArray (int *sz)
 array size in dimension 'd' is sz[d]. Assuming 'dims' sizes given.

 TensorArray (MyType const &)
 An exact copy of the given array.

 TensorArray (MyType const &, int d, int s, int e)
 An exact copy of the subarray, specified as: d:[s, e).

 TensorArray (MyType const &, int *start, int *end)
 An exact copy of the subarray, specified as: [start[], end[]).

 TensorArray (TensorArray< T, dims+1 > const &rhs, int d, int s)
 Construct from a slice from an array of SuperType(one dimension higher).

 ~TensorArray ()
TensorArray & Transform (xchen::Transform const &)
 Assume the element type can be transformed.

void Clear ()
 Delete all elements to become an empty array.

bool Empty () const
 return true if empty array.

void PopFront (int i=0)
 erase the front elements of each row in i dir.

void PopBack (int i=0)
 erase the back elements of each row in i dir.

void Insert (linear_iterator itr, T const &val)
 Insert before the linear iterator(point to the inserted afterward).++(size_at_last_dimension).

void Insert (int dir, int before)
 Insert 'before' at each row of the dir. ++(size_at_dir). Uninitialized.

void SetN (int N)
 Set reserved subdivision depth to N.

void InsertMiddlePoints (bool average=true)
 set sbd_dpth to 1 if 0. insert uninitualized or average value inbetween eles(rows). dec sbd_dpth.

void Averaging ()
 Averaging each hyper-cube cells into its lowerleft corner. dec sz in each dir by one.

TensorArray & operator= (const TensorArray &rhs)
 An exact copy of rhs, except the capacity.

int GetSize (int dir=0) const
 get array size in direction 'dir'.

void GetSize (int *Sz) const
 Sz[d] <-- array size of dir 'd'.

int GetTotalSize () const
 Get total elements in the multi-array.

void Reserve (int newCapacity,...)
 reserve at least 'newCapacity' for dir 'dims-1', and so on...

void Reserve (int *newCapacity)
 reserve at least newCapacity[d] for dir 'd'.

void Resize (int newSz,...)
 expand(no initialization) or cut to 'newSz' for dir 'dims-1', and so on...

void Resize (int *newSz)
 expand(no initialization) or cut to 'Sz[d]' for dir 'd'.

void ResizeOneDirection (int i, int new_sz)
 resize direction i.

void CopyExtend (int left,...)
 ArgList: left,right, left',right'... Copy-Expand two ends left and right times at dir dims-1, etc.

void CopyExtend (int *rightleft)
 Right-copy-expand 'rightleft[0]' and Left-copy-expand 'rightleft[1]' eles at dir 0, etc.

void CopyExtendAtDirection (int i, int left, int right)
 Left-Copy extend the left end point left times at dir i, and Right-Copy....

void ExtendAtDirection (int i, int left, int right)
 Left extend the left end point left times at dir i, and Right extend....

void Extend (int left,...)
 ArgList: left,right, ... Expand two ends left and right times at dir dims-1, and so on.

void Extend (int *rightleft)
 Right-expand 'rightleft[0]' and Left-expand 'rightleft[1]' eles at dir 0, etc. No initialization.

slc_iterator SliceIterate (int dir=0, int start=0, int end=0)
 end=0 defaults to size().

linear_iterator LinearIterate (int dir, int start, int len)
 Subarray is dir:[start, start+len).

linear_iterator LinearIterate (int *start=0, int *end=0)
 1D iterate the specified subarray

linear_iterator Begin ()
 Begin 1D iteration of the array.

linear_iterator End ()
 End 1D iteration of the array.

linear_riterator LinearReverseIterate (int dir, int start, int len)
 Subarray is dir:[start, start+len).

linear_riterator LinearReverseIterate (int *start=0, int *end=0)
 reverse version.

linear_riterator Rbegin ()
 reverse version.

linear_riterator Rend ()
 reverse version.

row_iterator RowIterate (int row_d, int subarray_d, int start, int len)
 Subarray is subarray_d:[start, start+len).

row_iterator RowIterate (int d=0, int *start=0, int *end=0)
 Iterate the subarray row by row.

row_riterator RowReverseIterate (int r_d, int sub_d, int start, int L)
 Subarray is sub_d:[start, start+L).

row_riterator RowReverseIterate (int d=0, int *start=0, int *end=0)
 Iterate the subarray row by row.

idx_op_ret_t operator[] (int i)
 Used for operations [][]..[].

T & operator[] (Vector< int, dims >const &i)
 Vector indexing operation.

ListAssignmentCheckSzRt< T,
linear_iterator > 
operator= (T)
 Assignment from a list.

T const & GetElement (int *idx) const
 Assume idx of len dims. idx[0] is lowest index.

T const & GetElement (int i,...) const
 Assume argLst of len dims. First arg is highest index.

void PrintShape () const
 Output size and capacity of each direction.


Friends

class TensorArray< T, dims-1 >
ostream & operator<< (ostream &os, const TensorArray &)


Detailed Description

template<typename T, int dims>
class xchen::TensorArray< T, dims >

A multi-array, with the same shape in each direction.


Constructor & Destructor Documentation

template<typename T, int dims>
xchen::TensorArray< T, dims >::TensorArray   [inline]
 

construct an empty tensor array.

template<typename T, int dims>
xchen::TensorArray< T, dims >::TensorArray int    sz,
...   
[inline, explicit]
 

1st arg is array size in dimension 'dims-1'. Assuming list has 'dims' args.

template<typename T, int dims>
xchen::TensorArray< T, dims >::TensorArray int *    sz [inline, explicit]
 

array size in dimension 'd' is sz[d]. Assuming 'dims' sizes given.

template<typename T, int dims>
xchen::TensorArray< T, dims >::TensorArray MyType const &    [inline]
 

An exact copy of the given array.

template<typename T, int dims>
xchen::TensorArray< T, dims >::TensorArray MyType const &   ,
int    d,
int    s,
int    e
[inline]
 

An exact copy of the subarray, specified as: d:[s, e).

template<typename T, int dims>
xchen::TensorArray< T, dims >::TensorArray MyType const &   ,
int *    start,
int *    end
[inline]
 

An exact copy of the subarray, specified as: [start[], end[]).

template<typename T, int dims>
xchen::TensorArray< T, dims >::TensorArray TensorArray< T, dims+1 > const &    rhs,
int    d,
int    s
[inline]
 

Construct from a slice from an array of SuperType(one dimension higher).

template<typename T, int dims>
xchen::TensorArray< T, dims >::~TensorArray   [inline]
 


Member Function Documentation

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Averaging  
 

Averaging each hyper-cube cells into its lowerleft corner. dec sz in each dir by one.

template<typename T, int dims>
linear_iterator xchen::TensorArray< T, dims >::Begin   [inline]
 

Begin 1D iteration of the array.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Clear   [inline]
 

Delete all elements to become an empty array.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::CopyExtend int *    rightleft [inline]
 

Right-copy-expand 'rightleft[0]' and Left-copy-expand 'rightleft[1]' eles at dir 0, etc.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::CopyExtend int    left,
...   
[inline]
 

ArgList: left,right, left',right'... Copy-Expand two ends left and right times at dir dims-1, etc.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::CopyExtendAtDirection int    i,
int    left,
int    right
[inline]
 

Left-Copy extend the left end point left times at dir i, and Right-Copy....

template<typename T, int dims>
bool xchen::TensorArray< T, dims >::Empty   const [inline]
 

return true if empty array.

template<typename T, int dims>
linear_iterator xchen::TensorArray< T, dims >::End   [inline]
 

End 1D iteration of the array.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Extend int *    rightleft [inline]
 

Right-expand 'rightleft[0]' and Left-expand 'rightleft[1]' eles at dir 0, etc. No initialization.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Extend int    left,
...   
[inline]
 

ArgList: left,right, ... Expand two ends left and right times at dir dims-1, and so on.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::ExtendAtDirection int    i,
int    left,
int    right
[inline]
 

Left extend the left end point left times at dir i, and Right extend....

template<typename T, int dims>
T const & xchen::TensorArray< T, dims >::GetElement int    i,
...   
const
 

Assume argLst of len dims. First arg is highest index.

template<typename T, int dims>
T const & xchen::TensorArray< T, dims >::GetElement int *    idx const
 

Assume idx of len dims. idx[0] is lowest index.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::GetSize int *    Sz const [inline]
 

Sz[d] <-- array size of dir 'd'.

template<typename T, int dims>
int xchen::TensorArray< T, dims >::GetSize int    dir = 0 const [inline]
 

get array size in direction 'dir'.

template<typename T, int dims>
int xchen::TensorArray< T, dims >::GetTotalSize   const [inline]
 

Get total elements in the multi-array.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Insert int    dir,
int    before
 

Insert 'before' at each row of the dir. ++(size_at_dir). Uninitialized.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Insert linear_iterator    itr,
T const &    val
 

Insert before the linear iterator(point to the inserted afterward).++(size_at_last_dimension).

template<typename T, int dims>
void xchen::TensorArray< T, dims >::InsertMiddlePoints bool    average = true
 

set sbd_dpth to 1 if 0. insert uninitualized or average value inbetween eles(rows). dec sbd_dpth.

template<typename T, int dims>
linear_iterator xchen::TensorArray< T, dims >::LinearIterate int *    start = 0,
int *    end = 0
[inline]
 

1D iterate the specified subarray

template<typename T, int dims>
TensorArray< T, dims >::linear_iterator xchen::TensorArray< T, dims >::LinearIterate int    dir,
int    start,
int    len
[inline]
 

Subarray is dir:[start, start+len).

template<typename T, int dims>
linear_riterator xchen::TensorArray< T, dims >::LinearReverseIterate int *    start = 0,
int *    end = 0
[inline]
 

reverse version.

template<typename T, int dims>
TensorArray< T, dims >::linear_riterator xchen::TensorArray< T, dims >::LinearReverseIterate int    dir,
int    start,
int    len
[inline]
 

Subarray is dir:[start, start+len).

template<typename T, int dims>
ListAssignmentCheckSzRt< T, typename TensorArray< T, dims >::linear_iterator > xchen::TensorArray< T, dims >::operator=  
 

Assignment from a list.

template<typename T, int dims>
TensorArray< T, dims > & xchen::TensorArray< T, dims >::operator= const TensorArray< T, dims > &    rhs
 

An exact copy of rhs, except the capacity.

template<typename T, int dims>
T & xchen::TensorArray< T, dims >::operator[] Vector< int, dims >const &    i [inline]
 

Vector indexing operation.

template<typename T, int dims>
TensorArrayIndexOperatorTraits< T, dims >::ReturnType xchen::TensorArray< T, dims >::operator[] int    i [inline]
 

Used for operations [][]..[].

template<typename T, int dims>
void xchen::TensorArray< T, dims >::PopBack int    i = 0
 

erase the back elements of each row in i dir.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::PopFront int    i = 0
 

erase the front elements of each row in i dir.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::PrintShape  
 

Output size and capacity of each direction.

template<typename T, int dims>
linear_riterator xchen::TensorArray< T, dims >::Rbegin   [inline]
 

reverse version.

template<typename T, int dims>
linear_riterator xchen::TensorArray< T, dims >::Rend   [inline]
 

reverse version.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Reserve int *    newCapacity
 

reserve at least newCapacity[d] for dir 'd'.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Reserve int    newCapacity,
...   
[inline]
 

reserve at least 'newCapacity' for dir 'dims-1', and so on...

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Resize int *    newSz
 

expand(no initialization) or cut to 'Sz[d]' for dir 'd'.

template<typename T, int dims>
void xchen::TensorArray< T, dims >::Resize int    newSz,
...   
[inline]
 

expand(no initialization) or cut to 'newSz' for dir 'dims-1', and so on...

template<typename T, int dims>
void xchen::TensorArray< T, dims >::ResizeOneDirection int    i,
int    new_sz
 

resize direction i.

template<typename T, int dims>
row_iterator xchen::TensorArray< T, dims >::RowIterate int    d = 0,
int *    start = 0,
int *    end = 0
[inline]
 

Iterate the subarray row by row.

template<typename T, int dims>
TensorArray< T, dims >::row_iterator xchen::TensorArray< T, dims >::RowIterate int    row_d,
int    subarray_d,
int    start,
int    len
[inline]
 

Subarray is subarray_d:[start, start+len).

template<typename T, int dims>
row_riterator xchen::TensorArray< T, dims >::RowReverseIterate int    d = 0,
int *    start = 0,
int *    end = 0
[inline]
 

Iterate the subarray row by row.

template<typename T, int dims>
TensorArray< T, dims >::row_riterator xchen::TensorArray< T, dims >::RowReverseIterate int    r_d,
int    sub_d,
int    start,
int    L
[inline]
 

Subarray is sub_d:[start, start+L).

template<typename T, int dims>
void xchen::TensorArray< T, dims >::SetN int    N [inline]
 

Set reserved subdivision depth to N.

template<typename T, int dims>
slc_iterator xchen::TensorArray< T, dims >::SliceIterate int    dir = 0,
int    start = 0,
int    end = 0
[inline]
 

end=0 defaults to size().

template<typename T, int dims>
TensorArray< T, dims > & xchen::TensorArray< T, dims >::Transform xchen::Transform const &    [inline]
 

Assume the element type can be transformed.


Friends And Related Function Documentation

template<typename T, int dims>
ostream& operator<< ostream &    os,
const TensorArray< T, dims > &    _ar
[friend]
 

template<typename T, int dims>
friend class TensorArray< T, dims-1 > [friend]
 


The documentation for this class was generated from the following file:
Generated on Wed Apr 7 21:40:51 2004 by doxygen1.2.18