MADNESS  0.10.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
madness::Tensor< T > Class Template Reference

A tensor is a multidimension array. More...

#include <tensor.h>

Inheritance diagram for madness::Tensor< T >:
Inheritance graph
[legend]
Collaboration diagram for madness::Tensor< T >:
Collaboration graph
[legend]

Public Types

typedef TensorTypeData< T >::float_scalar_type float_scalar_type
 C++ typename of the floating point type associated with scalar real type. More...
 
typedef TensorTypeData< T >::scalar_type scalar_type
 C++ typename of the real type associated with a complex type. More...
 
typedef T type
 C++ typename of this tensor. More...
 

Public Member Functions

 Tensor ()
 Default constructor does not allocate any data and sets ndim=-1, size=0, _p=0, and id. More...
 
 Tensor (const std::vector< long > &d, bool dozero=true)
 Create and optionally zero new n-d tensor. This is the most general constructor. More...
 
 Tensor (const Tensor< T > &t)
 Copy constructor is shallow (same as assignment) More...
 
 Tensor (long d0)
 Create and zero new 1-d tensor. More...
 
 Tensor (long d0, long d1)
 Create and zero new 2-d tensor. More...
 
 Tensor (long d0, long d1, long d2)
 Create and zero new 3-d tensor. More...
 
 Tensor (long d0, long d1, long d2, long d3)
 Create and zero new 4-d tensor. More...
 
 Tensor (long d0, long d1, long d2, long d3, long d4)
 Create and zero new 5-d tensor. More...
 
 Tensor (long d0, long d1, long d2, long d3, long d4, long d5)
 Create and zero new 6-d tensor. More...
 
 Tensor (long nd, const long d[], bool dozero=true)
 Politically incorrect general constructor. More...
 
virtual ~Tensor ()
 
scalar_type absmax (long *ind=0) const
 Return the absolute maximum value (and if ind is non-null, its index) in the Tensor. More...
 
scalar_type absmin (long *ind=0) const
 Return the absolute minimum value (and if ind is non-null, its index) in the Tensor. More...
 
BaseTensorbase ()
 Returns a pointer to the base class. More...
 
const BaseTensorbase () const
 Returns a pointer to the base class. More...
 
template<class Q >
TensorIterator< T, Qbinary_iterator (const Tensor< Q > &q, long iterlevel=0, bool optimize=true, bool fusedim=true, long jdim=default_jdim) const
 Return iterator over two tensors. More...
 
void clear ()
 Frees all memory and resests to state of default constructor. More...
 
template<class Q >
bool conforms (const Tensor< Q > &t) const
 Test if *this and t conform. More...
 
Tensor< T > & conj ()
 Inplace complex conjugate. More...
 
Tensor< Tcycledim (long nshift, long start, long end)
 Returns new view/tensor cycling the sub-dimensions (start,...,end) with shift steps. More...
 
const Tensor< Tcycledim (long nshift, long start, long end) const
 Returns new view/tensor cycling the sub-dimensions (start,...,end) with shift steps. More...
 
Tensor< T > & emul (const Tensor< T > &t)
 Inplace multiply by corresponding elements of argument Tensor. More...
 
const TensorIterator< T > & end () const
 End point for forward iteration. More...
 
Tensor< T > & fill (T x)
 Inplace fill with a scalar (legacy name) More...
 
Tensor< T > & fillindex ()
 Inplace fill with the index of each element. More...
 
Tensor< T > & fillrandom ()
 Inplace fill with random values ( [0,1] for floats, [0,MAXSIZE] for integers) More...
 
Tensor< Tflat ()
 Returns new view/tensor rehshaping to flat (1-d) tensor. More...
 
const Tensor< Tflat () const
 Returns new view/tensor rehshaping to flat (1-d) tensor. More...
 
Tensor< Tfusedim (long i)
 Returns new view/tensor fusing contiguous dimensions i and i+1. More...
 
const Tensor< Tfusedim (long i) const
 Returns new view/tensor fusing contiguous dimensions i and i+1. More...
 
Tensor< T > & gaxpy (T alpha, const Tensor< T > &t, T beta)
 Inplace generalized saxpy ... this = this*alpha + other*beta. More...
 
bool has_data () const
 
Tensor< Tmapdim (const std::vector< long > &map)
 Returns new view/tensor permuting the dimensions. More...
 
const Tensor< Tmapdim (const std::vector< long > &map) const
 Returns new view/tensor permuting the dimensions. More...
 
float_complex max (long *ind) const
 
double_complex max (long *ind) const
 
float_complex max (long *ind) const
 
double_complex max (long *ind) const
 
T max (long *ind=0) const
 Return the maximum value (and if ind is non-null, its index) in the Tensor. More...
 
float_complex min (long *ind) const
 
double_complex min (long *ind) const
 
float_complex min (long *ind) const
 
double_complex min (long *ind) const
 
T min (long *ind=0) const
 Return the minimum value (and if ind is non-null, its index) in the Tensor. More...
 
float_scalar_type normf () const
 Returns the Frobenius norm of the tensor. More...
 
template<class Q >
 operator Tensor< Q > () const
 Type conversion makes a deep copy. More...
 
Toperator() (const long ind[])
 Politically incorrect general indexing operation without bounds checking. More...
 
const Toperator() (const long ind[]) const
 Politically incorrect general indexing operation without bounds checking. More...
 
SliceTensor< Toperator() (const Slice &s0)
 Return a 1d SliceTensor that views the specified range of the 1d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0) const
 Return a 1d SliceTensor that views the specified range of the 1d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, const Slice &s1)
 Return a 2d SliceTensor that views the specified range of the 2d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, const Slice &s1) const
 Return a 2d constant Tensor that views the specified range of the 2d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, const Slice &s1, const Slice &s2)
 Return a 3d SliceTensor that views the specified range of the 3d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, const Slice &s1, const Slice &s2) const
 Return a 3d constant Tensor that views the specified range of the 3d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3)
 Return a 1-4d SliceTensor that views the specified range of the 4d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3) const
 Return a 1-4d constant Tensor that views the specified range of the 4d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3, const Slice &s4)
 Return a 1-5d SliceTensor that views the specified range of the 5d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3, const Slice &s4) const
 Return a 1-5d constant Tensor that views the specified range of the 5d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3, const Slice &s4, const Slice &s5)
 Return a 1-6d SliceTensor that views the specified range of the 6d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3, const Slice &s4, const Slice &s5) const
 Return a 1-6d constant Tensor that views the specified range of the 6d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, const Slice &s1, long k)
 Return a 2d SliceTensor that views the specified range of the 3d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, const Slice &s1, long k) const
 Return a 2d constant Tensor that views the specified range of the 3d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, long j)
 Return a 1d SliceTensor that views the specified range of the 2d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, long j) const
 Return a 1d constant Tensor that views the specified range of the 2d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, long j, const Slice &s2)
 Return a 2d SliceTensor that views the specified range of the 3d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, long j, const Slice &s2) const
 Return a 2d constant Tensor that views the specified range of the 3d Tensor. More...
 
SliceTensor< Toperator() (const Slice &s0, long j, long k)
 Return a 1d SliceTensor that views the specified range of the 3d Tensor. More...
 
const Tensor< Toperator() (const Slice &s0, long j, long k) const
 Return a 1d constant Tensor that views the specified range of the 3d Tensor. More...
 
SliceTensor< Toperator() (const std::array< Slice, TENSOR_MAXDIM > &s)
 General slicing operation. More...
 
const Tensor< Toperator() (const std::array< Slice, TENSOR_MAXDIM > &s) const
 General slicing operation (const) More...
 
Toperator() (const std::vector< long > ind)
 General indexing operation with bounds checking. More...
 
const Toperator() (const std::vector< long > ind) const
 General indexing operation with bounds checking. More...
 
SliceTensor< Toperator() (const std::vector< Slice > &s)
 General slicing operation. More...
 
const Tensor< Toperator() (const std::vector< Slice > &s) const
 General slicing operation (const) More...
 
Toperator() (long i)
 1-d indexing operation without bounds checking. More...
 
const Toperator() (long i) const
 1-d indexing operation without bounds checking. More...
 
SliceTensor< Toperator() (long i, const Slice &s1)
 Return a 1d SliceTensor that views the specified range of the 2d Tensor. More...
 
const Tensor< Toperator() (long i, const Slice &s1) const
 Return a 1d SliceTensor that views the specified range of the 2d Tensor. More...
 
SliceTensor< Toperator() (long i, const Slice &s1, const Slice &s2)
 Return a 2d SliceTensor that views the specified range of the 3d Tensor. More...
 
const Tensor< Toperator() (long i, const Slice &s1, const Slice &s2) const
 Return a 2d constant Tensor that views the specified range of the 3d Tensor. More...
 
SliceTensor< Toperator() (long i, const Slice &s1, long k)
 Return a 1d SliceTensor that views the specified range of the 3d Tensor. More...
 
const Tensor< Toperator() (long i, const Slice &s1, long k) const
 Return a 1d constant Tensor that views the specified range of the 3d Tensor. More...
 
Toperator() (long i, long j)
 2-d indexing operation without bounds checking. More...
 
const Toperator() (long i, long j) const
 2-d indexing operation without bounds checking. More...
 
SliceTensor< Toperator() (long i, long j, const Slice &s2)
 Return a 1d SliceTensor that views the specified range of the 3d Tensor. More...
 
const Tensor< Toperator() (long i, long j, const Slice &s2) const
 Return a 1d constant Tensor that views the specified range of the 3d Tensor. More...
 
Toperator() (long i, long j, long k)
 3-d indexing operation without bounds checking. More...
 
const Toperator() (long i, long j, long k) const
 3-d indexing operation without bounds checking. More...
 
Toperator() (long i, long j, long k, long l)
 4-d indexing operation without bounds checking. More...
 
const Toperator() (long i, long j, long k, long l) const
 4-d indexing operation without bounds checking. More...
 
Toperator() (long i, long j, long k, long l, long m)
 5-d indexing operation without bounds checking. More...
 
const Toperator() (long i, long j, long k, long l, long m) const
 5-d indexing operation without bounds checking. More...
 
Toperator() (long i, long j, long k, long l, long m, long n)
 6-d indexing operation without bounds checking. More...
 
const Toperator() (long i, long j, long k, long l, long m, long n) const
 6-d indexing operation without bounds checking. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >, Tensor< TENSOR_RESULT_TYPE(T, Q)> >::type operator* (const Q &x) const
 Multiplication of tensor by a scalar of a supported type to produce a new tensor. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator*= (const Q &x)
 Inplace multiplication by scalar of supported type. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >, Tensor< TENSOR_RESULT_TYPE(T, Q)> >::type operator+ (const Q &x) const
 Add a scalar of the same type to all elements of a tensor producing a new tensor. More...
 
template<typename Q >
Tensor< TENSOR_RESULT_TYPE(T, Q) > operator+ (const Tensor< Q > &t) const
 Addition of two tensors to produce a new tensor. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator+= (const Q &x)
 Inplace increment by scalar of supported type. More...
 
template<typename Q >
Tensor< T > & operator+= (const Tensor< Q > &t)
 Inplace addition of two tensors. More...
 
Tensor< Toperator- () const
 Unary negation producing a new tensor. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >, Tensor< TENSOR_RESULT_TYPE(T, Q)> >::type operator- (const Q &x) const
 Subtract a scalar of the same type from all elements producing a new tensor. More...
 
template<typename Q >
Tensor< TENSOR_RESULT_TYPE(T, Q) > operator- (const Tensor< Q > &t) const
 Subtraction of two tensors to produce a new tensor. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator-= (const Q &x)
 Inplace decrement by scalar of supported type. More...
 
template<typename Q >
Tensor< T > & operator-= (const Tensor< Q > &t)
 Inplace subtraction of two tensors. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >, Tensor< TENSOR_RESULT_TYPE(T, Q)> >::type operator/ (const Q &x) const
 Divide tensor by a scalar of a supported type to produce a new tensor. More...
 
Tensor< T > & operator= (const Tensor< T > &t)
 Assignment is shallow (same as copy constructor) More...
 
Tensor< T > & operator= (T x)
 Inplace fill tensor with scalar. More...
 
Toperator[] (long i)
 1-d indexing operation using [] without bounds checking. More...
 
const Toperator[] (long i) const
 1-d indexing operation using [] without bounds checking. More...
 
T product () const
 Return the product of all elements of the tensor. More...
 
Tptr ()
 Returns a pointer to the internal data. More...
 
const Tptr () const
 Returns a pointer to the internal data. More...
 
Tensor< Treshape (const std::vector< long > &d)
 Returns new view/tensor reshaping size/number of dimensions to conforming tensor. More...
 
const Tensor< Treshape (const std::vector< long > &d) const
 Returns new view/tensor reshaping size/number of dimensions to conforming tensor. More...
 
Tensor< Treshape (int ndimnew, const long *d)
 Returns new view/tensor reshaping size/number of dimensions to conforming tensor. More...
 
const Tensor< Treshape (int ndimnew, const long *d) const
 Returns new view/tensor reshaping size/number of dimensions to conforming tensor. More...
 
Tensor< Treshape (long dim0)
 Returns new view/tensor rehapings to conforming 1-d tensor with given dimension. More...
 
const Tensor< Treshape (long dim0) const
 Returns new view/tensor rehapings to conforming 1-d tensor with given dimension. More...
 
Tensor< Treshape (long dim0, long dim1)
 Returns new view/tensor rehaping to conforming 2-d tensor with given dimensions. More...
 
const Tensor< Treshape (long dim0, long dim1) const
 Returns new view/tensor rehaping to conforming 2-d tensor with given dimensions. More...
 
Tensor< Treshape (long dim0, long dim1, long dim2)
 Returns new view/tensor rehaping to conforming 3-d tensor with given dimensions. More...
 
const Tensor< Treshape (long dim0, long dim1, long dim2) const
 Returns new view/tensor rehaping to conforming 3-d tensor with given dimensions. More...
 
Tensor< Treshape (long dim0, long dim1, long dim2, long dim3)
 Returns new view/tensor rehaping to conforming 4-d tensor with given dimensions. More...
 
const Tensor< Treshape (long dim0, long dim1, long dim2, long dim3) const
 Returns new view/tensor rehaping to conforming 4-d tensor with given dimensions. More...
 
Tensor< Treshape (long dim0, long dim1, long dim2, long dim3, long dim4)
 Returns new view/tensor rehaping to conforming 5-d tensor with given dimensions. More...
 
const Tensor< Treshape (long dim0, long dim1, long dim2, long dim3, long dim4) const
 Returns new view/tensor rehaping to conforming 5-d tensor with given dimensions. More...
 
Tensor< Treshape (long dim0, long dim1, long dim2, long dim3, long dim4, long dim5)
 Returns new view/tensor rehaping to conforming 6-d tensor with given dimensions. More...
 
const Tensor< Treshape (long dim0, long dim1, long dim2, long dim3, long dim4, long dim5) const
 Returns new view/tensor rehaping to conforming 6-d tensor with given dimensions. More...
 
template<typename Q >
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type scale (Q x)
 Inplace multiplication by scalar of supported type (legacy name) More...
 
Tensor< T > & screen (double x)
 Inplace set elements of *this less than x in absolute magnitude to zero. More...
 
Tensor< Tsplitdim (long i, long dimi0, long dimi1)
 Returns new view/tensor splitting dimension i as dimi0*dimi1 to produce conforming d+1 dimension tensor. More...
 
const Tensor< Tsplitdim (long i, long dimi0, long dimi1) const
 Returns new view/tensor splitting dimension i as dimi0*dimi1 to produce conforming d+1 dimension tensor. More...
 
T sum () const
 Returns the sum of all elements of the tensor. More...
 
T sumsq () const
 Returns the sum of the squares of the elements. More...
 
Tensor< Tswapdim (long idim, long jdim)
 Returns new view/tensor swaping dimensions i and j. More...
 
const Tensor< Tswapdim (long idim, long jdim) const
 Returns new view/tensor swaping dimensions i and j. More...
 
template<class Q >
 TENSOR_RESULT_TYPE (T, Q) trace_conj(const Tensor< Q > &t) const
 Return the trace of two tensors with complex conjugate of the leftmost (i.e., this) More...
 
template<class Q , class R >
TensorIterator< T, Q, Rternary_iterator (const Tensor< Q > &q, const Tensor< R > &r, long iterlevel=0, bool optimize=true, bool fusedim=true, long jdim=default_jdim) const
 Return iterator over three tensors. More...
 
T trace (const Tensor< T > &t) const
 Return the trace of two tensors (no complex conjugate invoked) More...
 
TensorIterator< Tunary_iterator (long iterlevel=0, bool optimize=true, bool fusedim=true, long jdim=default_jdim) const
 Return iterator over single tensor. More...
 
template<typename opT >
Tensor< T > & unaryop (opT &op)
 Inplace apply a unary function to each element of the tensor. More...
 
- Public Member Functions inherited from madness::BaseTensor
 BaseTensor ()
 
virtual ~BaseTensor ()
 
bool conforms (const BaseTensor *t) const
 Returns true if this and *t are the same shape and size. More...
 
long dim (int i) const
 Returns the size of dimension i. More...
 
const long * dims () const
 Returns the array of tensor dimensions. More...
 
long id () const
 Returns the typeid of the tensor (c.f., TensorTypeData<T> ) More...
 
bool iscontiguous () const
 Returns true if the tensor refers to contiguous memory locations. More...
 
long ndim () const
 Returns the number of dimensions in the tensor. More...
 
long size () const
 Returns the number of elements in the tensor. More...
 
long stride (int i) const
 Returns the stride associated with dimension i. More...
 
const long * strides () const
 Returns the array of tensor strides. More...
 

Static Public Member Functions

static bool bounds_checking ()
 Return true if bounds checking was enabled at compile time. More...
 
- Static Public Member Functions inherited from madness::BaseTensor
static int get_instance_count ()
 Returns the count of all current instances of tensors & slice tensors of all types. More...
 

Protected Member Functions

void allocate (long nd, const long d[], bool dozero)
 
void deallocate ()
 
- Protected Member Functions inherited from madness::BaseTensor
void cycledim_inplace (long shift, long start, long end)
 Cyclic shift of dimensions. More...
 
void flat_inplace ()
 Reshapes the tensor inplace into 1D. More...
 
void fusedim_inplace (long i)
 Fuses dimensions i and i+1. More...
 
void mapdim_inplace (const std::vector< long > &map)
 General permutation of dimensions. More...
 
void reshape_inplace (const std::vector< long > &d)
 Reshapes the tensor inplace. More...
 
void reshape_inplace (int ndimnew, const long *d)
 Reshapes the tensor inplace. More...
 
void set_dims_and_size (long nd, const long d[])
 
void splitdim_inplace (long i, long dimi0, long dimi1)
 Splits dimension i. More...
 
void swapdim_inplace (long i, long j)
 Swaps the dimensions. More...
 

Protected Attributes

T *MADNESS_RESTRICT _p
 
TENSOR_SHARED_PTR< T_shptr
 
- Protected Attributes inherited from madness::BaseTensor
long _dim [TENSOR_MAXDIM]
 Size of each dimension. More...
 
long _id
 Id from TensorTypeData<T> in type_data.h. More...
 
long _ndim
 Number of dimensions (-1=invalid; 0=no supported; >0=tensor) More...
 
long _size
 Number of elements in the tensor. More...
 
long _stride [TENSOR_MAXDIM]
 Increment between elements in each dimension. More...
 

Friends

template<class U >
class SliceTensor
 

Detailed Description

template<class T>
class madness::Tensor< T >

A tensor is a multidimension array.

Member Typedef Documentation

◆ float_scalar_type

C++ typename of the floating point type associated with scalar real type.

◆ scalar_type

template<class T >
typedef TensorTypeData<T>::scalar_type madness::Tensor< T >::scalar_type

C++ typename of the real type associated with a complex type.

◆ type

template<class T >
typedef T madness::Tensor< T >::type

C++ typename of this tensor.

Constructor & Destructor Documentation

◆ Tensor() [1/10]

template<class T >
madness::Tensor< T >::Tensor ( )
inline

Default constructor does not allocate any data and sets ndim=-1, size=0, _p=0, and id.

References madness::BaseTensor::_id.

◆ Tensor() [2/10]

template<class T >
madness::Tensor< T >::Tensor ( const Tensor< T > &  t)
inline

Copy constructor is shallow (same as assignment)

Caveat emptor: The shallow copy constructor has many virtues but enables you to violate constness with simple code such as

const Tensor<double> a(5);
Tensor<double> b(a);
b[1] = 3; // a[1] is now also 3
static const double b
Definition: nonlinschro.cc:119
static const double a
Definition: nonlinschro.cc:118

References madness::BaseTensor::_id.

◆ Tensor() [3/10]

template<class T >
madness::Tensor< T >::Tensor ( long  d0)
inlineexplicit

Create and zero new 1-d tensor.

Parameters
[in]d0Size of dimension 0

References madness::BaseTensor::_dim, and madness::Tensor< T >::allocate().

◆ Tensor() [4/10]

template<class T >
madness::Tensor< T >::Tensor ( long  d0,
long  d1 
)
inlineexplicit

Create and zero new 2-d tensor.

Parameters
[in]d0Size of dimension 0
[in]d1Size of dimension 1

References madness::BaseTensor::_dim, and madness::Tensor< T >::allocate().

◆ Tensor() [5/10]

template<class T >
madness::Tensor< T >::Tensor ( long  d0,
long  d1,
long  d2 
)
inlineexplicit

Create and zero new 3-d tensor.

Parameters
[in]d0Size of dimension 0
[in]d1Size of dimension 1
[in]d2Size of dimension 2

References madness::BaseTensor::_dim, and madness::Tensor< T >::allocate().

◆ Tensor() [6/10]

template<class T >
madness::Tensor< T >::Tensor ( long  d0,
long  d1,
long  d2,
long  d3 
)
inlineexplicit

Create and zero new 4-d tensor.

Parameters
[in]d0Size of dimension 0
[in]d1Size of dimension 1
[in]d2Size of dimension 2
[in]d3Size of dimension 3

References madness::BaseTensor::_dim, and madness::Tensor< T >::allocate().

◆ Tensor() [7/10]

template<class T >
madness::Tensor< T >::Tensor ( long  d0,
long  d1,
long  d2,
long  d3,
long  d4 
)
inlineexplicit

Create and zero new 5-d tensor.

Parameters
[in]d0Size of dimension 0
[in]d1Size of dimension 1
[in]d2Size of dimension 2
[in]d3Size of dimension 3
[in]d4Size of dimension 4

References madness::BaseTensor::_dim, and madness::Tensor< T >::allocate().

◆ Tensor() [8/10]

template<class T >
madness::Tensor< T >::Tensor ( long  d0,
long  d1,
long  d2,
long  d3,
long  d4,
long  d5 
)
inlineexplicit

Create and zero new 6-d tensor.

Parameters
[in]d0Size of dimension 0
[in]d1Size of dimension 1
[in]d2Size of dimension 2
[in]d3Size of dimension 3
[in]d4Size of dimension 4
[in]d5Size of dimension 5

References madness::BaseTensor::_dim, and madness::Tensor< T >::allocate().

◆ Tensor() [9/10]

template<class T >
madness::Tensor< T >::Tensor ( const std::vector< long > &  d,
bool  dozero = true 
)
inlineexplicit

Create and optionally zero new n-d tensor. This is the most general constructor.

Parameters
[in]dVector containing size of each dimension, number of dimensions inferred from vector size.
[in]dozeroIf true (default) the tensor is initialized to zero

References madness::Tensor< T >::allocate(), and d().

◆ Tensor() [10/10]

template<class T >
madness::Tensor< T >::Tensor ( long  nd,
const long  d[],
bool  dozero = true 
)
inlineexplicit

Politically incorrect general constructor.

Parameters
[in]ndNumber of dimensions
[in]dSize of each dimension
[in]dozeroIf true (default) the tensor is initialized to zero

References madness::Tensor< T >::allocate(), and d().

◆ ~Tensor()

template<class T >
virtual madness::Tensor< T >::~Tensor ( )
inlinevirtual

Member Function Documentation

◆ absmax()

template<class T >
scalar_type madness::Tensor< T >::absmax ( long *  ind = 0) const
inline

◆ absmin()

template<class T >
scalar_type madness::Tensor< T >::absmin ( long *  ind = 0) const
inline

Return the absolute minimum value (and if ind is non-null, its index) in the Tensor.

References madness::BaseTensor::_ndim, std::abs(), T(), UNARY_OPTIMIZED_ITERATOR, and UNARY_UNOPTIMIZED_ITERATOR.

◆ allocate()

template<class T >
void madness::Tensor< T >::allocate ( long  nd,
const long  d[],
bool  dozero 
)
inlineprotected

◆ base() [1/2]

template<class T >
BaseTensor* madness::Tensor< T >::base ( )
inline

Returns a pointer to the base class.

◆ base() [2/2]

template<class T >
const BaseTensor* madness::Tensor< T >::base ( ) const
inline

Returns a pointer to the base class.

◆ binary_iterator()

template<class T >
template<class Q >
TensorIterator<T,Q> madness::Tensor< T >::binary_iterator ( const Tensor< Q > &  q,
long  iterlevel = 0,
bool  optimize = true,
bool  fusedim = true,
long  jdim = default_jdim 
) const
inline

Return iterator over two tensors.

References madness::Tensor< T >::fusedim(), and q().

◆ bounds_checking()

template<class T >
static bool madness::Tensor< T >::bounds_checking ( )
inlinestatic

Return true if bounds checking was enabled at compile time.

Returns
True if bounds checking was enabled at compile time

Referenced by main().

◆ clear()

template<class T >
void madness::Tensor< T >::clear ( )
inline

◆ conforms()

template<class T >
template<class Q >
bool madness::Tensor< T >::conforms ( const Tensor< Q > &  t) const
inline

◆ conj()

template<class T >
Tensor<T>& madness::Tensor< T >::conj ( )
inline

Inplace complex conjugate.

Returns
Reference to this tensor

References madness::conditional_conj(), T(), and UNARY_OPTIMIZED_ITERATOR.

Referenced by madness::FunctionImpl< T, NDIM >::do_inner_localX(), and madness::Function< T, NDIM >::doconj().

◆ cycledim() [1/2]

template<class T >
Tensor<T> madness::Tensor< T >::cycledim ( long  nshift,
long  start,
long  end 
)
inline

Returns new view/tensor cycling the sub-dimensions (start,...,end) with shift steps.

References madness::BaseTensor::cycledim_inplace(), and madness::Tensor< T >::end().

Referenced by madness::apply(), and madness::Derivative< T, NDIM >::do_diff2b().

◆ cycledim() [2/2]

template<class T >
const Tensor<T> madness::Tensor< T >::cycledim ( long  nshift,
long  start,
long  end 
) const
inline

Returns new view/tensor cycling the sub-dimensions (start,...,end) with shift steps.

References madness::BaseTensor::cycledim_inplace(), and madness::Tensor< T >::end().

◆ deallocate()

template<class T >
void madness::Tensor< T >::deallocate ( )
inlineprotected

◆ emul()

template<class T >
Tensor<T>& madness::Tensor< T >::emul ( const Tensor< T > &  t)
inline

◆ end()

template<class T >
const TensorIterator<T>& madness::Tensor< T >::end ( ) const
inline

◆ fill()

template<class T >
Tensor<T>& madness::Tensor< T >::fill ( T  x)
inline

◆ fillindex()

template<class T >
Tensor<T>& madness::Tensor< T >::fillindex ( )
inline

Inplace fill with the index of each element.

Each element is assigned it's logical index according to this loop structure

Tensor<float> t(5,6,7,...)
long index=0;
for (long i=0; i<_dim[0]; ++i)
for (long j=0; j<_dim[1]; ++j)
for (long k=0; k<_dim[2]; ++k)
...
tensor(i,j,k,...) = index++
long _dim[TENSOR_MAXDIM]
Size of each dimension.
Definition: basetensor.h:96
static const long k
Definition: rk.cc:44
Returns
Reference to this tensor

References T(), and UNARY_UNOPTIMIZED_ITERATOR.

Referenced by Test1().

◆ fillrandom()

template<class T >
Tensor<T>& madness::Tensor< T >::fillrandom ( )
inline

◆ flat() [1/2]

template<class T >
Tensor<T> madness::Tensor< T >::flat ( )
inline

◆ flat() [2/2]

template<class T >
const Tensor<T> madness::Tensor< T >::flat ( ) const
inline

Returns new view/tensor rehshaping to flat (1-d) tensor.

References madness::BaseTensor::_size, d(), and madness::Tensor< T >::reshape().

◆ fusedim() [1/2]

template<class T >
Tensor<T> madness::Tensor< T >::fusedim ( long  i)
inline

Returns new view/tensor fusing contiguous dimensions i and i+1.

Returns
New tensor (viewing same underlying data as the original but with fewer dimensions)

References madness::BaseTensor::fusedim_inplace().

Referenced by madness::Tensor< T >::binary_iterator(), madness::FunctionImpl< T, NDIM >::partial_inner_contract(), madness::TensorTrain< T >::reconstruct(), madness::Tensor< T >::ternary_iterator(), madness::TensorTrain< T >::trace(), and madness::Tensor< T >::unary_iterator().

◆ fusedim() [2/2]

template<class T >
const Tensor<T> madness::Tensor< T >::fusedim ( long  i) const
inline

Returns new view/tensor fusing contiguous dimensions i and i+1.

Returns
New tensor (viewing same underlying data as the original but with fewer dimensions)

References madness::BaseTensor::fusedim_inplace().

◆ gaxpy()

template<class T >
Tensor<T>& madness::Tensor< T >::gaxpy ( T  alpha,
const Tensor< T > &  t,
T  beta 
)
inline

◆ has_data()

template<class T >
bool madness::Tensor< T >::has_data ( ) const
inline

◆ mapdim() [1/2]

template<class T >
Tensor<T> madness::Tensor< T >::mapdim ( const std::vector< long > &  map)
inline

Returns new view/tensor permuting the dimensions.

Parameters
[in]mapOld dimension i becomes new dimension map[i]
Returns
New tensor (viewing same underlying data as the original but with reordered dimensions)

References madness::BaseTensor::mapdim_inplace().

Referenced by madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()().

◆ mapdim() [2/2]

template<class T >
const Tensor<T> madness::Tensor< T >::mapdim ( const std::vector< long > &  map) const
inline

Returns new view/tensor permuting the dimensions.

Returns
New tensor (viewing same underlying data as the original but with reordered dimensions)

References madness::BaseTensor::mapdim_inplace().

◆ max() [1/5]

float_complex madness::Tensor< float_complex >::max ( long *  ind) const

References TENSOR_EXCEPTION.

◆ max() [2/5]

double_complex madness::Tensor< double_complex >::max ( long *  ind) const

References TENSOR_EXCEPTION.

◆ max() [3/5]

float_complex madness::Tensor< float_complex >::max ( long *  ind) const

◆ max() [4/5]

double_complex madness::Tensor< double_complex >::max ( long *  ind) const

◆ max() [5/5]

template<class T >
T madness::Tensor< T >::max ( long *  ind = 0) const
inline

◆ min() [1/5]

float_complex madness::Tensor< float_complex >::min ( long *  ind) const

References TENSOR_EXCEPTION.

◆ min() [2/5]

double_complex madness::Tensor< double_complex >::min ( long *  ind) const

References TENSOR_EXCEPTION.

◆ min() [3/5]

float_complex madness::Tensor< float_complex >::min ( long *  ind) const

◆ min() [4/5]

double_complex madness::Tensor< double_complex >::min ( long *  ind) const

◆ min() [5/5]

template<class T >
T madness::Tensor< T >::min ( long *  ind = 0) const
inline

◆ normf()

template<class T >
float_scalar_type madness::Tensor< T >::normf ( ) const
inline

Returns the Frobenius norm of the tensor.

References madness::detail::mynorm(), T(), and UNARY_OPTIMIZED_ITERATOR.

Referenced by madness::ConvolutionData1D< Q >::ConvolutionData1D(), madness::GeneralTwoElectronInterface< T, NDIM >::GeneralTwoElectronInterface(), madness::GenericConvolution1D< Q, opT >::GenericConvolution1D(), MolecularNuclearPotentialFunctor2::MolecularNuclearPotentialFunctor2(), madness::TwoElectronInterface< T, NDIM >::TwoElectronInterface(), madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push_op(), madness::projector_irrep::apply_symmetry_operators(), madness::BSHOperatorPtr3D(), madness::LowRankFunction< T, NDIM, LDIM >::check_orthonormality(), madness::PNO::check_orthonormality(), madness::SRConf< T >::check_right_orthonormality(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::compute_error_from_inaccurate_refinement(), madness::Diamagnetic_potential_factor::compute_nabla_R_div_R(), madness::OEP::compute_ocep_correction(), madness::RandomizedMatrixDecomposition< T >::compute_range(), madness::SVDTensor< T >::compute_svd(), madness::FunctionImpl< T, NDIM >::do_apply(), madness::FunctionImpl< T, NDIM >::do_apply_kernel(), madness::FunctionImpl< T, NDIM >::do_apply_kernel2(), madness::RandomizedMatrixDecomposition< T >::do_compute_range(), madness::gelss(), madness::GMRES(), madness::GradBSHOperator(), GradBSHOperator_Joel(), madness::GradCoulombOperator(), gradPbarA(), madness::GradSlaterOperator(), madness::SeparatedConvolution< Q, NDIM >::make_coeff_for_operator(), make_grad_operator(), madness::Solver< T, NDIM >::matrix_exponential(), madness::Localizer::matrix_exponential(), matrix_exponential(), madness::FunctionImpl< T, NDIM >::mulXXa(), madness::FunctionImpl< T, NDIM >::mulXXveca(), madness::detail::norm(), norm(), madness::hartree_leaf_op< T, NDIM >::operator()(), madness::hartree_convolute_leaf_op< T, NDIM, LDIM, opT >::operator()(), madness::FunctionImpl< T, NDIM >::pointwise_multiplier< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::MolecularOptimizer::optimize_conjugate_gradients(), madness::MolecularOptimizer::optimize_quasi_newton(), madness::PeriodicBSHOperator3D(), madness::PeriodicBSHOperatorPtr3D(), madness::PeriodicHFExchangeOperator(), projector_external_dof(), madness::MolecularOptimizer::projector_external_dof(), Test7(), test_asymmetric(), test_hermiticity(), madness::test_inverse(), test_orthogonalization(), madness::FunctionImpl< T, NDIM >::tnorm(), and Calculation::update().

◆ operator Tensor< Q >()

template<class T >
template<class Q >
madness::Tensor< T >::operator Tensor< Q > ( ) const
inline

Type conversion makes a deep copy.

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, BINARY_OPTIMIZED_ITERATOR, Q(), and T().

◆ operator()() [1/48]

template<class T >
T& madness::Tensor< T >::operator() ( const long  ind[])
inline

Politically incorrect general indexing operation without bounds checking.

Parameters
[in]indArray containing index for each dimension
Returns
Reference to element

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, d(), offset, and TENSOR_ASSERT.

◆ operator()() [2/48]

template<class T >
const T& madness::Tensor< T >::operator() ( const long  ind[]) const
inline

Politically incorrect general indexing operation without bounds checking.

Parameters
[in]indArray containing index for each dimension
Returns
Reference to element

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, d(), offset, and TENSOR_ASSERT.

◆ operator()() [3/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0)
inline

Return a 1d SliceTensor that views the specified range of the 1d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [4/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0) const
inline

Return a 1d SliceTensor that views the specified range of the 1d Tensor.

Returns
Constant Tensor viewing patch of original tensor: $ R(*,*,\ldots) \rightarrow I(*,*,\ldots) $

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [5/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1 
)
inline

Return a 2d SliceTensor that views the specified range of the 2d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [6/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1 
) const
inline

Return a 2d constant Tensor that views the specified range of the 2d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [7/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
const Slice s2 
)
inline

Return a 3d SliceTensor that views the specified range of the 3d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [8/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
const Slice s2 
) const
inline

Return a 3d constant Tensor that views the specified range of the 3d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [9/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
const Slice s2,
const Slice s3 
)
inline

Return a 1-4d SliceTensor that views the specified range of the 4d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [10/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
const Slice s2,
const Slice s3 
) const
inline

Return a 1-4d constant Tensor that views the specified range of the 4d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [11/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
const Slice s2,
const Slice s3,
const Slice s4 
)
inline

Return a 1-5d SliceTensor that views the specified range of the 5d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [12/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
const Slice s2,
const Slice s3,
const Slice s4 
) const
inline

Return a 1-5d constant Tensor that views the specified range of the 5d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [13/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
const Slice s2,
const Slice s3,
const Slice s4,
const Slice s5 
)
inline

Return a 1-6d SliceTensor that views the specified range of the 6d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [14/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
const Slice s2,
const Slice s3,
const Slice s4,
const Slice s5 
) const
inline

Return a 1-6d constant Tensor that views the specified range of the 6d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [15/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
long  k 
)
inline

Return a 2d SliceTensor that views the specified range of the 3d Tensor.

Returns
SliceTensor viewing patch of original tensor

References k, madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [16/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
const Slice s1,
long  k 
) const
inline

Return a 2d constant Tensor that views the specified range of the 3d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References k, madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [17/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
long  j 
)
inline

Return a 1d SliceTensor that views the specified range of the 2d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [18/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
long  j 
) const
inline

Return a 1d constant Tensor that views the specified range of the 2d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [19/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
long  j,
const Slice s2 
)
inline

Return a 2d SliceTensor that views the specified range of the 3d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [20/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
long  j,
const Slice s2 
) const
inline

Return a 2d constant Tensor that views the specified range of the 3d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [21/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const Slice s0,
long  j,
long  k 
)
inline

Return a 1d SliceTensor that views the specified range of the 3d Tensor.

Returns
SliceTensor viewing patch of original tensor

References k, madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [22/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const Slice s0,
long  j,
long  k 
) const
inline

Return a 1d constant Tensor that views the specified range of the 3d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References k, madness::BaseTensor::ndim(), s0, and TENSOR_ASSERT.

◆ operator()() [23/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const std::array< Slice, TENSOR_MAXDIM > &  s)
inline

General slicing operation.

Parameters
[in]sarray containing slice for each dimension
Returns
SliceTensor viewing patch of original tensor

◆ operator()() [24/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const std::array< Slice, TENSOR_MAXDIM > &  s) const
inline

General slicing operation (const)

Parameters
[in]sarray containing slice for each dimension
Returns
Constant Tensor viewing patch of original tensor

◆ operator()() [25/48]

template<class T >
T& madness::Tensor< T >::operator() ( const std::vector< long >  ind)
inline

General indexing operation with bounds checking.

Parameters
[in]indVector containing index for each dimension
Returns
Reference to element

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, d(), and TENSOR_ASSERT.

◆ operator()() [26/48]

template<class T >
const T& madness::Tensor< T >::operator() ( const std::vector< long >  ind) const
inline

General indexing operation with bounds checking.

Parameters
[in]indVector containing index for each dimension
Returns
Reference to element

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, d(), and TENSOR_ASSERT.

◆ operator()() [27/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( const std::vector< Slice > &  s)
inline

General slicing operation.

Parameters
[in]sVector containing slice for each dimension
Returns
SliceTensor viewing patch of original tensor

References TENSOR_ASSERT.

◆ operator()() [28/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( const std::vector< Slice > &  s) const
inline

General slicing operation (const)

Parameters
[in]sVector containing slice for each dimension
Returns
Constant Tensor viewing patch of original tensor

References TENSOR_ASSERT.

◆ operator()() [29/48]

template<class T >
T& madness::Tensor< T >::operator() ( long  i)
inline

1-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, and TENSOR_ASSERT.

◆ operator()() [30/48]

template<class T >
const T& madness::Tensor< T >::operator() ( long  i) const
inline

1-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, and TENSOR_ASSERT.

◆ operator()() [31/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( long  i,
const Slice s1 
)
inline

Return a 1d SliceTensor that views the specified range of the 2d Tensor.

Returns
SliceTensor viewing patch of original tensor: $ R(*) \rightarrow I(i,*) $

References madness::BaseTensor::ndim(), and TENSOR_ASSERT.

◆ operator()() [32/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( long  i,
const Slice s1 
) const
inline

Return a 1d SliceTensor that views the specified range of the 2d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), and TENSOR_ASSERT.

◆ operator()() [33/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( long  i,
const Slice s1,
const Slice s2 
)
inline

Return a 2d SliceTensor that views the specified range of the 3d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), and TENSOR_ASSERT.

◆ operator()() [34/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( long  i,
const Slice s1,
const Slice s2 
) const
inline

Return a 2d constant Tensor that views the specified range of the 3d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), and TENSOR_ASSERT.

◆ operator()() [35/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( long  i,
const Slice s1,
long  k 
)
inline

Return a 1d SliceTensor that views the specified range of the 3d Tensor.

Returns
SliceTensor viewing patch of original tensor

References k, madness::BaseTensor::ndim(), and TENSOR_ASSERT.

◆ operator()() [36/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( long  i,
const Slice s1,
long  k 
) const
inline

Return a 1d constant Tensor that views the specified range of the 3d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References k, madness::BaseTensor::ndim(), and TENSOR_ASSERT.

◆ operator()() [37/48]

template<class T >
T& madness::Tensor< T >::operator() ( long  i,
long  j 
)
inline

2-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, and TENSOR_ASSERT.

◆ operator()() [38/48]

template<class T >
const T& madness::Tensor< T >::operator() ( long  i,
long  j 
) const
inline

2-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, and TENSOR_ASSERT.

◆ operator()() [39/48]

template<class T >
SliceTensor<T> madness::Tensor< T >::operator() ( long  i,
long  j,
const Slice s2 
)
inline

Return a 1d SliceTensor that views the specified range of the 3d Tensor.

Returns
SliceTensor viewing patch of original tensor

References madness::BaseTensor::ndim(), and TENSOR_ASSERT.

◆ operator()() [40/48]

template<class T >
const Tensor<T> madness::Tensor< T >::operator() ( long  i,
long  j,
const Slice s2 
) const
inline

Return a 1d constant Tensor that views the specified range of the 3d Tensor.

Returns
Constant Tensor viewing patch of original tensor

References madness::BaseTensor::ndim(), and TENSOR_ASSERT.

◆ operator()() [41/48]

template<class T >
T& madness::Tensor< T >::operator() ( long  i,
long  j,
long  k 
)
inline

3-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
[in]kindex for dimension 2
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, k, and TENSOR_ASSERT.

◆ operator()() [42/48]

template<class T >
const T& madness::Tensor< T >::operator() ( long  i,
long  j,
long  k 
) const
inline

3-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
[in]kindex for dimension 2
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, k, and TENSOR_ASSERT.

◆ operator()() [43/48]

template<class T >
T& madness::Tensor< T >::operator() ( long  i,
long  j,
long  k,
long  l 
)
inline

4-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
[in]kindex for dimension 2
[in]lindex for dimension 3
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, k, and TENSOR_ASSERT.

◆ operator()() [44/48]

template<class T >
const T& madness::Tensor< T >::operator() ( long  i,
long  j,
long  k,
long  l 
) const
inline

4-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
[in]kindex for dimension 2
[in]lindex for dimension 3
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, k, and TENSOR_ASSERT.

◆ operator()() [45/48]

template<class T >
T& madness::Tensor< T >::operator() ( long  i,
long  j,
long  k,
long  l,
long  m 
)
inline

5-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
[in]kindex for dimension 2
[in]lindex for dimension 3
[in]mindex for dimension 4
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, k, m, and TENSOR_ASSERT.

◆ operator()() [46/48]

template<class T >
const T& madness::Tensor< T >::operator() ( long  i,
long  j,
long  k,
long  l,
long  m 
) const
inline

5-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
[in]kindex for dimension 2
[in]lindex for dimension 3
[in]mindex for dimension 4
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, k, m, and TENSOR_ASSERT.

◆ operator()() [47/48]

template<class T >
T& madness::Tensor< T >::operator() ( long  i,
long  j,
long  k,
long  l,
long  m,
long  n 
)
inline

6-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
[in]kindex for dimension 2
[in]lindex for dimension 3
[in]mindex for dimension 4
[in]nindex for dimension 5
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, k, m, and TENSOR_ASSERT.

◆ operator()() [48/48]

template<class T >
const T& madness::Tensor< T >::operator() ( long  i,
long  j,
long  k,
long  l,
long  m,
long  n 
) const
inline

6-d indexing operation without bounds checking.

Parameters
[in]iindex for dimension 0
[in]jindex for dimension 1
[in]kindex for dimension 2
[in]lindex for dimension 3
[in]mindex for dimension 4
[in]nindex for dimension 5
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, k, m, and TENSOR_ASSERT.

◆ operator*()

template<class T >
template<typename Q >
IsSupported<TensorTypeData<Q>, Tensor<TENSOR_RESULT_TYPE(T,Q)> >::type madness::Tensor< T >::operator* ( const Q x) const
inline

Multiplication of tensor by a scalar of a supported type to produce a new tensor.

Parameters
[in]xScalar value
Returns
New tensor

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, BINARY_OPTIMIZED_ITERATOR, Q(), T(), and madness::Tensor< T >::TENSOR_RESULT_TYPE().

◆ operator*=()

template<class T >
template<typename Q >
IsSupported<TensorTypeData<Q>,Tensor<T>&>::type madness::Tensor< T >::operator*= ( const Q x)
inline

Inplace multiplication by scalar of supported type.

Parameters
[in]xScalar value
Returns
Reference to this tensor

References T(), and UNARY_OPTIMIZED_ITERATOR.

◆ operator+() [1/2]

template<class T >
template<typename Q >
IsSupported<TensorTypeData<Q>, Tensor<TENSOR_RESULT_TYPE(T,Q)> >::type madness::Tensor< T >::operator+ ( const Q x) const
inline

Add a scalar of the same type to all elements of a tensor producing a new tensor.

Parameters
[in]xScalar value
Returns
New tensor

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, BINARY_OPTIMIZED_ITERATOR, Q(), T(), and madness::Tensor< T >::TENSOR_RESULT_TYPE().

◆ operator+() [2/2]

template<class T >
template<typename Q >
Tensor< TENSOR_RESULT_TYPE(T,Q) > madness::Tensor< T >::operator+ ( const Tensor< Q > &  t) const
inline

Addition of two tensors to produce a new tensor.

Parameters
[in]tConforming tensor to be added out-of-place to this tensor
Returns
New tensor

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, Q(), T(), madness::Tensor< T >::TENSOR_RESULT_TYPE(), and TERNARY_OPTIMIZED_ITERATOR.

◆ operator+=() [1/2]

template<class T >
template<typename Q >
IsSupported<TensorTypeData<Q>,Tensor<T>&>::type madness::Tensor< T >::operator+= ( const Q x)
inline

Inplace increment by scalar of supported type.

Parameters
[in]xScalar value
Returns
Reference to this tensor

References T(), and UNARY_OPTIMIZED_ITERATOR.

◆ operator+=() [2/2]

template<class T >
template<typename Q >
Tensor<T>& madness::Tensor< T >::operator+= ( const Tensor< Q > &  t)
inline

Inplace addition of two tensors.

Parameters
[in]tConforming tensor to be added in-place to this tensor
Returns
Reference to this tensor

References BINARY_OPTIMIZED_ITERATOR, and T().

◆ operator-() [1/3]

template<class T >
Tensor<T> madness::Tensor< T >::operator- ( ) const
inline

Unary negation producing a new tensor.

Returns
New tensor

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, BINARY_OPTIMIZED_ITERATOR, and T().

◆ operator-() [2/3]

template<class T >
template<typename Q >
IsSupported<TensorTypeData<Q>, Tensor<TENSOR_RESULT_TYPE(T,Q)> >::type madness::Tensor< T >::operator- ( const Q x) const
inline

Subtract a scalar of the same type from all elements producing a new tensor.

Parameters
[in]xScalar value
Returns
New tensor

◆ operator-() [3/3]

template<class T >
template<typename Q >
Tensor< TENSOR_RESULT_TYPE(T,Q) > madness::Tensor< T >::operator- ( const Tensor< Q > &  t) const
inline

Subtraction of two tensors to produce a new tensor.

Parameters
[in]tConforming tensor to be subtracted out-of-place from this tensor
Returns
New tensor

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, Q(), T(), madness::Tensor< T >::TENSOR_RESULT_TYPE(), and TERNARY_OPTIMIZED_ITERATOR.

◆ operator-=() [1/2]

template<class T >
template<typename Q >
IsSupported<TensorTypeData<Q>,Tensor<T>&>::type madness::Tensor< T >::operator-= ( const Q x)
inline

Inplace decrement by scalar of supported type.

Parameters
[in]xScalar value
Returns
Reference to this tensor

References T(), and UNARY_OPTIMIZED_ITERATOR.

◆ operator-=() [2/2]

template<class T >
template<typename Q >
Tensor<T>& madness::Tensor< T >::operator-= ( const Tensor< Q > &  t)
inline

Inplace subtraction of two tensors.

Parameters
[in]tConforming tensor to be subtracted in-place from this tensor
Returns
Reference to this tensor

References BINARY_OPTIMIZED_ITERATOR, and T().

◆ operator/()

template<class T >
template<typename Q >
IsSupported<TensorTypeData<Q>, Tensor<TENSOR_RESULT_TYPE(T,Q)> >::type madness::Tensor< T >::operator/ ( const Q x) const
inline

Divide tensor by a scalar of a supported type to produce a new tensor.

Parameters
[in]xScalar value
Returns
New tensor

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, BINARY_OPTIMIZED_ITERATOR, Q(), T(), and madness::Tensor< T >::TENSOR_RESULT_TYPE().

◆ operator=() [1/2]

template<class T >
Tensor<T>& madness::Tensor< T >::operator= ( const Tensor< T > &  t)
inline

Assignment is shallow (same as copy constructor)

Caveat emptor: The shallow assignment has many virtues but enables you to violate constness with simple code such as

const Tensor<double> a(5);
Tensor<double> b;
b = a;
b[1] = 3; // a[1] is now also 3

References madness::BaseTensor::_dim, madness::BaseTensor::_ndim, madness::Tensor< T >::_p, madness::Tensor< T >::_shptr, madness::BaseTensor::_size, madness::BaseTensor::_stride, MADNESS_PRAGMA_GCC, madness::pop(), and TENSOR_MAXDIM.

◆ operator=() [2/2]

template<class T >
Tensor<T>& madness::Tensor< T >::operator= ( T  x)
inline

Inplace fill tensor with scalar.

Parameters
[in]xValue used to fill tensor via assigment
Returns
Reference to this tensor

References T(), and UNARY_OPTIMIZED_ITERATOR.

◆ operator[]() [1/2]

template<class T >
T& madness::Tensor< T >::operator[] ( long  i)
inline

1-d indexing operation using [] without bounds checking.

Parameters
[in]iindex for dimension 0
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, and TENSOR_ASSERT.

◆ operator[]() [2/2]

template<class T >
const T& madness::Tensor< T >::operator[] ( long  i) const
inline

1-d indexing operation using [] without bounds checking.

Parameters
[in]iindex for dimension 0
Returns
Reference to element

References madness::BaseTensor::_dim, madness::Tensor< T >::_p, madness::BaseTensor::_stride, and TENSOR_ASSERT.

◆ product()

template<class T >
T madness::Tensor< T >::product ( ) const
inline

Return the product of all elements of the tensor.

References T(), and UNARY_OPTIMIZED_ITERATOR.

Referenced by madness::FunctionDefaults< NDIM >::recompute_cell_info().

◆ ptr() [1/2]

template<class T >
T* madness::Tensor< T >::ptr ( )
inline

Returns a pointer to the internal data.

References madness::Tensor< T >::_p.

Referenced by madness::Convolution1D< Q >::Convolution1D(), madness::TensorIterator< T, Q, R >::TensorIterator(), madness::FunctionCommonData< T, NDIM >::_init_quadrature(), madness::SeparatedConvolution< Q, NDIM >::apply_transformation(), madness::Localizer::compute_core_valence_separation_transformation_matrix(), madness::FunctionImpl< T, NDIM >::do_inner_localX(), AtomicBasis::eval_guess_density(), madness::AtomicBasis::eval_guess_density(), madness::FunctionImpl< T, NDIM >::eval_plot_cube(), madness::XCfunctional::exc(), madness::fast_transform(), madness::fcube(), madness::Tensor< T >::fillrandom(), madness::Tensor< T >::gaxpy(), madness::geev(), geev_(), madness::gelss(), gelss_(), geqp3_(), madness::geqp3_result(), madness::gesv(), gesvd_(), get_fock_transformation(), madness::SCF::get_fock_transformation(), madness::ggev(), ggev_(), madness::inner(), madness::inner_result(), madness::inverse(), madness::archive::ArchiveLoadImpl< Archive, Tensor< T > >::load(), madness::load_coeffs(), madness::Localizer::localize_boys(), madness::Localizer::localize_new(), madness::lq_result(), main(), madness::matrix_inner(), madness::matrix_inner_old(), madness::Convolution1D< Q >::mod_nonstandard(), madness::Convolution1D< Q >::nonstandard(), madness::xc_lda_potential::operator()(), myunaryop_square< T, NDIM >::operator()(), BoysLocalization::operator()(), madness::orgqr(), madness::outer_result(), madness::plotdx(), madness::FunctionImpl< T, NDIM >::print_stats(), readin(), madness::TensorIterator< T, Q, R >::reuse(), madness::GenericConvolution1D< Q, opT >::rnlp(), madness::rr_cholesky(), madness::archive::ArchiveStoreImpl< Archive, Tensor< T > >::store(), madness::svd(), madness::svd_result(), madness::syev(), syev_(), madness::sygv(), sygv_(), madness::SystolicMatrixAlgorithm< T >::unshuffle(), madness::SubspaceK< T, NDIM >::update_subspace(), madness::Subspace< T, NDIM >::update_subspace(), and madness::SCF::update_subspace().

◆ ptr() [2/2]

template<class T >
const T* madness::Tensor< T >::ptr ( ) const
inline

Returns a pointer to the internal data.

References madness::Tensor< T >::_p.

◆ reshape() [1/16]

template<class T >
Tensor<T> madness::Tensor< T >::reshape ( const std::vector< long > &  d)
inline

Returns new view/tensor reshaping size/number of dimensions to conforming tensor.

Parameters
[in]dArray containing size of each new dimension
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [2/16]

template<class T >
const Tensor<T> madness::Tensor< T >::reshape ( const std::vector< long > &  d) const
inline

Returns new view/tensor reshaping size/number of dimensions to conforming tensor.

Parameters
[in]dArray containing size of each new dimension
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [3/16]

template<class T >
Tensor<T> madness::Tensor< T >::reshape ( int  ndimnew,
const long *  d 
)
inline

◆ reshape() [4/16]

template<class T >
const Tensor<T> madness::Tensor< T >::reshape ( int  ndimnew,
const long *  d 
) const
inline

Returns new view/tensor reshaping size/number of dimensions to conforming tensor.

Parameters
[in]ndimnewNumber of dimensions in the result
[in]dArray containing size of each new dimension
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::BaseTensor::reshape_inplace().

◆ reshape() [5/16]

template<class T >
Tensor<T> madness::Tensor< T >::reshape ( long  dim0)
inline

Returns new view/tensor rehapings to conforming 1-d tensor with given dimension.

Parameters
[in]dim0Size of new dimension 0
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [6/16]

template<class T >
const Tensor<T> madness::Tensor< T >::reshape ( long  dim0) const
inline

Returns new view/tensor rehapings to conforming 1-d tensor with given dimension.

Parameters
[in]dim0Size of new dimension 0
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [7/16]

template<class T >
Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1 
)
inline

Returns new view/tensor rehaping to conforming 2-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [8/16]

template<class T >
const Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1 
) const
inline

Returns new view/tensor rehaping to conforming 2-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [9/16]

template<class T >
Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1,
long  dim2 
)
inline

Returns new view/tensor rehaping to conforming 3-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
[in]dim2Size of new dimension 2
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [10/16]

template<class T >
const Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1,
long  dim2 
) const
inline

Returns new view/tensor rehaping to conforming 3-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
[in]dim2Size of new dimension 2
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [11/16]

template<class T >
Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1,
long  dim2,
long  dim3 
)
inline

Returns new view/tensor rehaping to conforming 4-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
[in]dim2Size of new dimension 2
[in]dim3Size of new dimension 3
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [12/16]

template<class T >
const Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1,
long  dim2,
long  dim3 
) const
inline

Returns new view/tensor rehaping to conforming 4-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
[in]dim2Size of new dimension 2
[in]dim3Size of new dimension 3
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [13/16]

template<class T >
Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1,
long  dim2,
long  dim3,
long  dim4 
)
inline

Returns new view/tensor rehaping to conforming 5-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
[in]dim2Size of new dimension 2
[in]dim3Size of new dimension 3
[in]dim4Size of new dimension 4
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [14/16]

template<class T >
const Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1,
long  dim2,
long  dim3,
long  dim4 
) const
inline

Returns new view/tensor rehaping to conforming 5-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
[in]dim2Size of new dimension 2
[in]dim3Size of new dimension 3
[in]dim4Size of new dimension 4
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [15/16]

template<class T >
Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1,
long  dim2,
long  dim3,
long  dim4,
long  dim5 
)
inline

Returns new view/tensor rehaping to conforming 6-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
[in]dim2Size of new dimension 2
[in]dim3Size of new dimension 3
[in]dim4Size of new dimension 4
[in]dim5Size of new dimension 5
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ reshape() [16/16]

template<class T >
const Tensor<T> madness::Tensor< T >::reshape ( long  dim0,
long  dim1,
long  dim2,
long  dim3,
long  dim4,
long  dim5 
) const
inline

Returns new view/tensor rehaping to conforming 6-d tensor with given dimensions.

Parameters
[in]dim0Size of new dimension 0
[in]dim1Size of new dimension 1
[in]dim2Size of new dimension 2
[in]dim3Size of new dimension 3
[in]dim4Size of new dimension 4
[in]dim5Size of new dimension 5
Returns
New tensor (viewing same underlying data as the original but with different shape)

References d(), and madness::Tensor< T >::reshape().

◆ scale()

template<class T >
template<typename Q >
IsSupported<TensorTypeData<Q>,Tensor<T>&>::type madness::Tensor< T >::scale ( Q  x)
inline

◆ screen()

template<class T >
Tensor<T>& madness::Tensor< T >::screen ( double  x)
inline

Inplace set elements of *this less than x in absolute magnitude to zero.

Parameters
[in]xScalar value
Returns
Reference to this tensor

References std::abs(), T(), and UNARY_OPTIMIZED_ITERATOR.

Referenced by madness::ortho3(), and madness::ortho5().

◆ splitdim() [1/2]

template<class T >
Tensor<T> madness::Tensor< T >::splitdim ( long  i,
long  dimi0,
long  dimi1 
)
inline

Returns new view/tensor splitting dimension i as dimi0*dimi1 to produce conforming d+1 dimension tensor.

Returns
New tensor (viewing same underlying data as the original but with additional dimensions)

References madness::BaseTensor::splitdim_inplace().

◆ splitdim() [2/2]

template<class T >
const Tensor<T> madness::Tensor< T >::splitdim ( long  i,
long  dimi0,
long  dimi1 
) const
inline

Returns new view/tensor splitting dimension i as dimi0*dimi1 to produce conforming d+1 dimension tensor.

Returns
New tensor (viewing same underlying data as the original but with additional dimensions)

References madness::BaseTensor::splitdim_inplace().

◆ sum()

template<class T >
T madness::Tensor< T >::sum ( ) const
inline

◆ sumsq()

template<class T >
T madness::Tensor< T >::sumsq ( ) const
inline

◆ swapdim() [1/2]

template<class T >
Tensor<T> madness::Tensor< T >::swapdim ( long  idim,
long  jdim 
)
inline

Returns new view/tensor swaping dimensions i and j.

Returns
New tensor (viewing same underlying data as the original but with reordered dimensions)

References madness::BaseTensor::swapdim_inplace().

Referenced by madness::conj_transpose(), PNOTensors::Tensor_IJ_IK< T >::set(), PNOTensors::Tensor_IJ_KJ< T >::set(), Test7(), madness::transform_dir(), and madness::transpose().

◆ swapdim() [2/2]

template<class T >
const Tensor<T> madness::Tensor< T >::swapdim ( long  idim,
long  jdim 
) const
inline

Returns new view/tensor swaping dimensions i and j.

Returns
New tensor (viewing same underlying data as the original but with reordered dimensions)

References madness::BaseTensor::swapdim_inplace().

◆ TENSOR_RESULT_TYPE()

template<class T >
template<class Q >
madness::Tensor< T >::TENSOR_RESULT_TYPE ( T  ,
Q   
) const &
inline

Return the trace of two tensors with complex conjugate of the leftmost (i.e., this)

References BINARY_OPTIMIZED_ITERATOR, madness::conditional_conj(), Q(), and T().

Referenced by madness::Tensor< T >::operator*(), madness::Tensor< T >::operator+(), madness::Tensor< T >::operator-(), and madness::Tensor< T >::operator/().

◆ ternary_iterator()

template<class T >
template<class Q , class R >
TensorIterator<T,Q,R> madness::Tensor< T >::ternary_iterator ( const Tensor< Q > &  q,
const Tensor< R > &  r,
long  iterlevel = 0,
bool  optimize = true,
bool  fusedim = true,
long  jdim = default_jdim 
) const
inline

Return iterator over three tensors.

References madness::Tensor< T >::fusedim(), and q().

◆ trace()

template<class T >
T madness::Tensor< T >::trace ( const Tensor< T > &  t) const
inline

◆ unary_iterator()

template<class T >
TensorIterator<T> madness::Tensor< T >::unary_iterator ( long  iterlevel = 0,
bool  optimize = true,
bool  fusedim = true,
long  jdim = default_jdim 
) const
inline

◆ unaryop()

template<class T >
template<typename opT >
Tensor<T>& madness::Tensor< T >::unaryop ( opT &  op)
inline

Friends And Related Function Documentation

◆ SliceTensor

template<class T >
template<class U >
friend class SliceTensor
friend

Member Data Documentation

◆ _p

template<class T >
T* MADNESS_RESTRICT madness::Tensor< T >::_p
protected

◆ _shptr

template<class T >
TENSOR_SHARED_PTR<T> madness::Tensor< T >::_shptr
protected

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