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

PLearn::TTensor< T > Class Template Reference

#include <Tensor.h>

Collaboration diagram for PLearn::TTensor< T >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TTensorElementIterator<
T > 
iterator
typedef TTensorSubTensorIterator<
T > 
subTensorIterator

Public Member Functions

 TTensor ()
 TTensor (IVec len)
 TTensor (const IVec &len, const T &init_value)
int resize (const IVec &len)
 don't call this from a subTensor !!

int ndims () const
IVec width () const
IVec sizes () const
int size (int k) const
int totalElements () const
int linearIndex (const IVec &pos) const
int linearIndex (const vector< int > &pos) const
TTensor< T > subTensor (const IVec &from, const IVec &len)
TTensor< T > DEPRECATEDsubTensor (const IVec &from, const IVec &len, bool throw_useless_dimensions=true)
TTensor< T > operator[] (int i)
void selectDimensions (const IVec &dim)
T & operator() (const IVec &pos) const
T & operator() (const vector< int > &pos) const
void fill (const T &val)
T * data () const
IVec lastElementPos () const
iterator begin ()
 returns an iterator over elements

iterator end ()
subTensorIterator getSubTensorIterator (const IVec &v)
 returns an iterator over subTensors


Protected Attributes

int offset_
IVec stride_
IVec width_
PP< Storage< T > > storage

Friends

class TTensorElementIterator< T >
class TTensorSubTensorIterator< T >

template<class T>
class PLearn::TTensor< T >


Member Typedef Documentation

template<class T>
typedef TTensorElementIterator<T> PLearn::TTensor< T >::iterator
 

Definition at line 189 of file Tensor.h.

template<class T>
typedef TTensorSubTensorIterator<T> PLearn::TTensor< T >::subTensorIterator
 

Definition at line 190 of file Tensor.h.


Constructor & Destructor Documentation

template<class T>
PLearn::TTensor< T >::TTensor  )  [inline]
 

template<class T>
PLearn::TTensor< T >::TTensor IVec  len  )  [inline]
 

template<class T>
PLearn::TTensor< T >::TTensor const IVec len,
const T &  init_value
[inline]
 


Member Function Documentation

template<class T>
iterator PLearn::TTensor< T >::begin  )  [inline]
 

returns an iterator over elements

Definition at line 382 of file Tensor.h.

References PLearn::IVec, and PLearn::TTensor< T >::ndims().

template<class T>
T* PLearn::TTensor< T >::data  )  const [inline]
 

Definition at line 363 of file Tensor.h.

References PLearn::TTensor< T >::offset_, PLERROR, and PLearn::TTensor< T >::storage.

template<class T>
TTensor<T> PLearn::TTensor< T >::DEPRECATEDsubTensor const IVec from,
const IVec len,
bool  throw_useless_dimensions = true
[inline]
 

Definition at line 305 of file Tensor.h.

References PLearn::TTensor< T >::DEPRECATEDsubTensor(), PLearn::TinyVector< T, N, TTrait >::empty(), PLearn::TTensor< T >::ndims(), PLearn::TTensor< T >::offset_, PLERROR, PLearn::TinyVector< T, N, TTrait >::push_back(), PLearn::TTensor< T >::selectDimensions(), and PLearn::TTensor< T >::width_.

Referenced by PLearn::TTensor< T >::DEPRECATEDsubTensor().

template<class T>
iterator PLearn::TTensor< T >::end  )  [inline]
 

Definition at line 389 of file Tensor.h.

References PLearn::TTensor< T >::lastElementPos().

template<class T>
void PLearn::TTensor< T >::fill const T &  val  )  [inline]
 

Definition at line 356 of file Tensor.h.

References PLearn::TTensor< T >::fill(), PLearn::TTensor< T >::totalElements(), and val.

Referenced by PLearn::TTensor< T >::fill().

template<class T>
subTensorIterator PLearn::TTensor< T >::getSubTensorIterator const IVec v  )  [inline]
 

returns an iterator over subTensors

Definition at line 395 of file Tensor.h.

References PLearn::TTensor< T >::getSubTensorIterator().

Referenced by PLearn::TTensor< T >::getSubTensorIterator().

template<class T>
IVec PLearn::TTensor< T >::lastElementPos  )  const [inline]
 

Definition at line 372 of file Tensor.h.

References PLearn::TTensor< T >::ndims(), PLearn::TinyVector< T, N, TTrait >::resize(), and PLearn::TTensor< T >::width_.

Referenced by PLearn::TTensor< T >::end().

template<class T>
int PLearn::TTensor< T >::linearIndex const vector< int > &  pos  )  const [inline]
 

Definition at line 262 of file Tensor.h.

References PLearn::TTensor< T >::ndims(), and PLearn::TTensor< T >::stride_.

template<class T>
int PLearn::TTensor< T >::linearIndex const IVec pos  )  const [inline]
 

Definition at line 254 of file Tensor.h.

References PLearn::TTensor< T >::linearIndex(), PLearn::TTensor< T >::ndims(), and PLearn::TTensor< T >::stride_.

Referenced by PLearn::TTensor< T >::linearIndex().

template<class T>
int PLearn::TTensor< T >::ndims  )  const [inline]
 

Definition at line 238 of file Tensor.h.

References PLearn::TinyVector< T, N, TTrait >::size(), and PLearn::TTensor< T >::width_.

Referenced by PLearn::TTensor< T >::begin(), PLearn::TTensor< T >::DEPRECATEDsubTensor(), PLearn::TTensor< T >::lastElementPos(), PLearn::TTensor< T >::linearIndex(), PLearn::TTensor< T >::operator[](), PLearn::TTensor< T >::resize(), PLearn::TTensor< T >::subTensor(), and PLearn::TTensor< T >::totalElements().

template<class T>
T& PLearn::TTensor< T >::operator() const vector< int > &  pos  )  const [inline]
 

Definition at line 354 of file Tensor.h.

References PLearn::TTensor< T >::operator()().

template<class T>
T& PLearn::TTensor< T >::operator() const IVec pos  )  const [inline]
 

Definition at line 353 of file Tensor.h.

References PLearn::TTensor< T >::operator()().

Referenced by PLearn::TTensor< T >::operator()().

template<class T>
TTensor<T> PLearn::TTensor< T >::operator[] int  i  )  [inline]
 

Definition at line 327 of file Tensor.h.

References k, PLearn::TTensor< T >::ndims(), PLearn::TTensor< T >::operator[](), and PLearn::TinyVector< T, N, TTrait >::push_back().

Referenced by PLearn::TTensor< T >::operator[]().

template<class T>
int PLearn::TTensor< T >::resize const IVec len  )  [inline]
 

don't call this from a subTensor !!

Definition at line 224 of file Tensor.h.

References PLearn::TTensor< T >::ndims(), PLearn::TTensor< T >::offset_, PLearn::TinyVector< T, N, TTrait >::resize(), PLearn::TTensor< T >::storage, PLearn::TTensor< T >::stride_, PLearn::TTensor< T >::totalElements(), and PLearn::TTensor< T >::width_.

template<class T>
void PLearn::TTensor< T >::selectDimensions const IVec dim  )  [inline]
 

Definition at line 341 of file Tensor.h.

References PLearn::TinyVector< T, N, TTrait >::push_back(), PLearn::TTensor< T >::selectDimensions(), PLearn::TinyVector< T, N, TTrait >::size(), PLearn::TTensor< T >::stride_, and PLearn::TTensor< T >::width_.

Referenced by PLearn::TTensor< T >::DEPRECATEDsubTensor(), PLearn::TTensor< T >::selectDimensions(), and PLearn::TTensor< T >::subTensor().

template<class T>
int PLearn::TTensor< T >::size int  k  )  const [inline]
 

Definition at line 242 of file Tensor.h.

References k, PLearn::TTensor< T >::size(), and PLearn::TTensor< T >::width_.

Referenced by PLearn::TTensor< T >::size().

template<class T>
IVec PLearn::TTensor< T >::sizes  )  const [inline]
 

Definition at line 241 of file Tensor.h.

References PLearn::TTensor< T >::width_.

template<class T>
TTensor<T> PLearn::TTensor< T >::subTensor const IVec from,
const IVec len
[inline]
 

Definition at line 274 of file Tensor.h.

References PLearn::TinyVector< T, N, TTrait >::empty(), PLearn::TTensor< T >::ndims(), PLearn::TTensor< T >::offset_, PLERROR, PLearn::TinyVector< T, N, TTrait >::push_back(), PLearn::TTensor< T >::selectDimensions(), PLearn::TTensor< T >::subTensor(), and PLearn::TTensor< T >::width_.

Referenced by PLearn::TTensor< T >::subTensor().

template<class T>
int PLearn::TTensor< T >::totalElements  )  const [inline]
 

Definition at line 244 of file Tensor.h.

References PLearn::TTensor< T >::ndims(), and PLearn::TTensor< T >::width_.

Referenced by PLearn::TTensor< T >::fill(), and PLearn::TTensor< T >::resize().

template<class T>
IVec PLearn::TTensor< T >::width  )  const [inline]
 

Definition at line 240 of file Tensor.h.

References PLearn::TTensor< T >::width_.


Friends And Related Function Documentation

template<class T>
friend class TTensorElementIterator< T > [friend]
 

Definition at line 180 of file Tensor.h.

template<class T>
friend class TTensorSubTensorIterator< T > [friend]
 

Definition at line 181 of file Tensor.h.


Member Data Documentation

template<class T>
int PLearn::TTensor< T >::offset_ [protected]
 

the displacement to do with respect to storage->data

Definition at line 183 of file Tensor.h.

Referenced by PLearn::TTensor< T >::data(), PLearn::TTensor< T >::DEPRECATEDsubTensor(), PLearn::TTensor< T >::resize(), and PLearn::TTensor< T >::subTensor().

template<class T>
PP< Storage<T> > PLearn::TTensor< T >::storage [protected]
 

where the data is really kept

Definition at line 186 of file Tensor.h.

Referenced by PLearn::TTensor< T >::data(), and PLearn::TTensor< T >::resize().

template<class T>
IVec PLearn::TTensor< T >::stride_ [protected]
 

the linear memory displacement, for each dimension, to the next element in the same dimension

Definition at line 184 of file Tensor.h.

Referenced by PLearn::TTensor< T >::linearIndex(), PLearn::TTensor< T >::resize(), and PLearn::TTensor< T >::selectDimensions().

template<class T>
IVec PLearn::TTensor< T >::width_ [protected]
 

the actual widths of each dimensions of the tensor

Definition at line 185 of file Tensor.h.

Referenced by PLearn::TTensor< T >::DEPRECATEDsubTensor(), PLearn::TTensor< T >::lastElementPos(), PLearn::TTensor< T >::ndims(), PLearn::TTensor< T >::resize(), PLearn::TTensor< T >::selectDimensions(), PLearn::TTensor< T >::size(), PLearn::TTensor< T >::sizes(), PLearn::TTensor< T >::subTensor(), PLearn::TTensor< T >::totalElements(), and PLearn::TTensor< T >::width().


The documentation for this class was generated from the following file:
Generated on Tue Aug 17 16:24:03 2004 for PLearn by doxygen 1.3.7