|
PLearn 0.1
|
#include <Tensor.h>

Public Member Functions | |
| TTensorSubTensorIterator (TTensor< T > *tensor_, const IVec &dim) | |
| TTensorSubTensorIterator () | |
| IVec | position () const |
| TTensorSubTensorIterator< T > & | operator++ () |
| TTensor< T > | operator* () const |
| bool | end () const |
Private Attributes | |
| TTensor< T > * | tensor |
| IVec | position_ |
| IVec | dimensions_ |
| bool | end_met |
| PLearn::TTensorSubTensorIterator< T >::TTensorSubTensorIterator | ( | TTensor< T > * | tensor_, |
| const IVec & | dim | ||
| ) | [inline] |
| PLearn::TTensorSubTensorIterator< T >::TTensorSubTensorIterator | ( | ) | [inline] |
| bool PLearn::TTensorSubTensorIterator< T >::end | ( | ) | const [inline] |
| TTensor<T> PLearn::TTensorSubTensorIterator< T >::operator* | ( | ) | const [inline] |
| TTensorSubTensorIterator< T > & PLearn::TTensorSubTensorIterator< T >::operator++ | ( | ) | [inline] |
Definition at line 440 of file Tensor.h.
References i.
{
bool found=false;
int idx=-1;
// find the lowest index of the position vector we can increment
while(!found && idx<(signed int)(tensor->ndims()-1))
{
idx++;
found = position_[idx]!=-1 && position_[idx]<tensor->width_[idx]-1;
}
if(found)
{
position_[idx]++;
for(int i=0;i<idx;i++)
if(position_[i]!=-1)
position_[i]=0;
}
else
// all subTensors of the tensor have been visited
end_met=true;
return *this;
}
| IVec PLearn::TTensorSubTensorIterator< T >::position | ( | ) | const [inline] |
IVec PLearn::TTensorSubTensorIterator< T >::dimensions_ [private] |
bool PLearn::TTensorSubTensorIterator< T >::end_met [private] |
IVec PLearn::TTensorSubTensorIterator< T >::position_ [private] |
TTensor<T>* PLearn::TTensorSubTensorIterator< T >::tensor [private] |
1.7.4