MADNESS 0.10.1
Public Member Functions | Public Attributes | Private 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.
 
bool operator!= (const TensorIterator< T, Q, R > &a) const
 
Toperator* () const
 
TensorIterator< T, Q, R > & operator++ ()
 
TensorIterator< T, Q, R > * operator-> ()
 
bool operator== (const TensorIterator< T, Q, R > &a) const
 
void reset ()
 Reset the iterator back to the start ...
 
void reuse (const Tensor< T > *t0, const Tensor< Q > *t1=0, const Tensor< R > *t2=0)
 Reuse this iterator to iterate over other Tensors.
 

Public Attributes

T_p0
 
Q_p1
 
R_p2
 
long _s0
 
long _s1
 
long _s2
 
long dim [TENSOR_MAXDIM]
 
long dimj
 
long ind [TENSOR_MAXDIM]
 
long ndim
 
long stride0 [TENSOR_MAXDIM]
 
long stride1 [TENSOR_MAXDIM]
 
long stride2 [TENSOR_MAXDIM]
 

Private Attributes

T_p0_save
 
Q_p1_save
 
R_p2_save
 

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

◆ operator!=()

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

◆ operator*()

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

◆ operator++()

template<class T , class Q , class R >
TensorIterator< T, Q, R > & madness::TensorIterator< T, Q, R >::operator++ ( )

References d.

◆ operator->()

template<class T , class Q = T, class R = T>
TensorIterator< T, Q, R > * madness::TensorIterator< T, Q, R >::operator-> ( )
inline

◆ operator==()

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

◆ reset()

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_result().

◆ reuse()

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 madness::Tensor< T >::ptr(), and TENSOR_MAXDIM.

Member Data Documentation

◆ _p0

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

◆ _p0_save

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

◆ _p1

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

◆ _p1_save

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

◆ _p2

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

◆ _p2_save

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

◆ _s0

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

◆ _s1

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

◆ _s2

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

◆ dim

template<class T , class Q = T, class R = T>
long madness::TensorIterator< T, Q, R >::dim[TENSOR_MAXDIM]

◆ dimj

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

Referenced by madness::outer_result().

◆ ind

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

◆ ndim

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

◆ stride0

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

◆ stride1

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

◆ stride2

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: