36#ifndef MADNESS_TENSOR_TENSORITER_H__INCLUDED
37#define MADNESS_TENSOR_TENSORITER_H__INCLUDED
54 template <
class T>
class Tensor;
82 bool optimize=
true,
bool fusedim=
true,
156 template <
class T,
class Q,
class R>
175 TENSOR_ASSERT(iterlevel==0 || iterlevel==1,
"invalid iteration level",iterlevel,t0);
180 for (
int i=0; i<
ndim; ++i) {
203 if (iterlevel == 0) {
212 else if (iterlevel == 1) {
214 if (jdim < 0) jdim +=
ndim;
219 for (
int i=0; i<
ndim; ++i) {
221 for (
int j=i; j<
ndim; ++j) {
264 for (
int i=jdim+1; i<=
ndim; ++i) {
277 for (
int i=
ndim-1; i>=0; --i) {
290 for (
int i=
ndim-1; i>=0; --i) {
302 for (
int i=
ndim-1; i>=0; --i) {
327 template <
class T,
class Q,
class R>
353 template <
class T,
class Q,
class R>
369 template <
class T,
class Q,
class R>
long dim(int i) const
Returns the size of dimension i.
Definition basetensor.h:147
long stride(int i) const
Returns the stride associated with dimension i.
Definition basetensor.h:150
long ndim() const
Returns the number of dimensions in the tensor.
Definition basetensor.h:144
Indexing a non-constant tensor with slices returns a SliceTensor.
Definition tensor.h:2062
R * _p2_save
Definition tensoriter.h:64
long stride0[TENSOR_MAXDIM]
Definition tensoriter.h:76
bool operator==(const TensorIterator< T, Q, R > &a) const
Definition tensoriter.h:87
long dim[TENSOR_MAXDIM]
Definition tensoriter.h:74
long stride1[TENSOR_MAXDIM]
Definition tensoriter.h:77
T * _p0_save
Definition tensoriter.h:62
void reuse(const Tensor< T > *t0, const Tensor< Q > *t1=0, const Tensor< R > *t2=0)
Reuse this iterator to iterate over other Tensors.
Definition tensoriter.h:370
long dimj
Definition tensoriter.h:70
long _s1
Definition tensoriter.h:72
bool operator!=(const TensorIterator< T, Q, R > &a) const
Definition tensoriter.h:91
long _s0
Definition tensoriter.h:71
Q * _p1
Definition tensoriter.h:67
long ndim
Definition tensoriter.h:69
TensorIterator< T, Q, R > & operator++()
Definition tensoriter.h:328
void reset()
Reset the iterator back to the start ...
Definition tensoriter.h:354
long ind[TENSOR_MAXDIM]
Definition tensoriter.h:75
Q * _p1_save
Definition tensoriter.h:63
TensorIterator< T, Q, R > * operator->()
Definition tensoriter.h:95
T & operator*() const
Definition tensoriter.h:99
R * _p2
Definition tensoriter.h:68
T * _p0
Definition tensoriter.h:66
long stride2[TENSOR_MAXDIM]
Definition tensoriter.h:78
long _s2
Definition tensoriter.h:73
A tensor is a multidimensional array.
Definition tensor.h:313
T * ptr()
Returns a pointer to the internal data.
Definition tensor.h:1845
bool conforms(const Tensor< Q > &t) const
Test if *this and t conform.
Definition tensor.h:1662
static const double R
Definition csqrt.cc:46
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.
Definition tensoriter.h:157
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
static const long default_jdim
Definition tensoriter.h:57
static long abs(long a)
Definition tensor.h:214
static const double d
Definition nonlinschro.cc:121
static const double a
Definition nonlinschro.cc:118
double Q(double a)
Definition relops.cc:20
Defines and implements most of Tensor.
#define TENSOR_MAXDIM
Definition tensor_macros.h:194
Declares and implements TensorException.
#define TENSOR_ASSERT(condition, msg, value, t)
Definition tensorexcept.h:130