MADNESS  version 0.9
Public Member Functions | Public Attributes | List of all members
madness::TensorIterator< T, Q, R > Class Template Reference

#include <tensoriter.h>

Public Member Functions

 TensorIterator (const Tensor< T > *t0, const Tensor< Q > *t1=0, const Tensor< R > *t2=0, long iterlevel=0, bool optimize=true, bool fusedim=true, long jdim=default_jdim)
 Constructor for general iterator to compose operations over up to three tensors. More...
 
TensorIterator< T, Q, R > & operator++ ()
 
bool operator== (const TensorIterator< T, Q, R > &a) const
 
bool operator!= (const TensorIterator< T, Q, R > &a) const
 
TensorIterator< T, Q, R > * operator-> ()
 
T & operator* () const
 
void reset ()
 Reset the iterator back to the start ... More...
 
void reuse (const Tensor< T > *t0, const Tensor< Q > *t1=0, const Tensor< R > *t2=0)
 Reuse this iterator to iterate over other Tensors. More...
 

Public Attributes

T * _p0
 
Q * _p1
 
R_p2
 
long ndim
 
long dimj
 
long _s0
 
long _s1
 
long _s2
 
long dim [TENSOR_MAXDIM]
 
long ind [TENSOR_MAXDIM]
 
long stride0 [TENSOR_MAXDIM]
 
long stride1 [TENSOR_MAXDIM]
 
long stride2 [TENSOR_MAXDIM]
 

Detailed Description

template<class T, class Q = T, class R = T>
class madness::TensorIterator< T, Q, R >

Optimized iterator for tensors supporting unary, binary and ternary operations.

Member Function Documentation

template<class T, class Q = T, class R = T>
bool madness::TensorIterator< T, Q, R >::operator!= ( const TensorIterator< T, Q, R > &  a) const
inline
template<class T, class Q = T, class R = T>
T& madness::TensorIterator< T, Q, R >::operator* ( ) const
inline
template<class T , class Q , class R >
TensorIterator< T, Q, R > & madness::TensorIterator< T, Q, R >::operator++ ( )

References mpfr::dim().

template<class T, class Q = T, class R = T>
TensorIterator<T,Q,R>* madness::TensorIterator< T, Q, R >::operator-> ( )
inline
template<class T, class Q = T, class R = T>
bool madness::TensorIterator< T, Q, R >::operator== ( const TensorIterator< T, Q, R > &  a) const
inline
template<class T , class Q , class R >
void madness::TensorIterator< T, Q, R >::reset ( )

Reset the iterator back to the start ...

References TENSOR_MAXDIM.

Referenced by madness::inner_result(), and madness::outer().

template<class T , class Q , class R >
void madness::TensorIterator< T, Q, R >::reuse ( const Tensor< T > *  t0,
const Tensor< Q > *  t1 = 0,
const Tensor< R > *  t2 = 0 
)

Reuse this iterator to iterate over other Tensors.

The point of this method is to optimize away the construction of a TensorIterator when applying the same operation repeatedly to multiple tensors with identical shapes & strides. We trust the caller to ensure all shapes & strides match between the new tensors and the ones used in the original constructor.

References TENSOR_MAXDIM.

Member Data Documentation

template<class T, class Q = T, class R = T>
T* madness::TensorIterator< T, Q, R >::_p0
template<class T, class Q = T, class R = T>
Q* madness::TensorIterator< T, Q, R >::_p1
template<class T, class Q = T, class R = T>
R* madness::TensorIterator< T, Q, R >::_p2
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::_s0
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::_s1
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::_s2
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::dim[TENSOR_MAXDIM]
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::dimj

Referenced by madness::outer().

template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::ind[TENSOR_MAXDIM]
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::ndim
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::stride0[TENSOR_MAXDIM]
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::stride1[TENSOR_MAXDIM]
template<class T, class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::stride2[TENSOR_MAXDIM]

The documentation for this class was generated from the following file: