MADNESS 0.10.1
tensor.h File Reference

Defines and implements most of Tensor. More...

#include <madness/madness_config.h>
#include <madness/misc/ran.h>
#include <madness/world/posixmem.h>
#include <madness/world/thread_specific.h>
#include <memory>
#include <complex>
#include <vector>
#include <array>
#include <cmath>
#include <cstdlib>
#include <cstddef>
#include <madness/world/archive.h>
#include <madness/tensor/basetensor.h>
#include <madness/tensor/aligned.h>
#include <madness/tensor/mxm.h>
#include <madness/tensor/tensorexcept.h>
#include <madness/tensor/tensoriter.h>
Include dependency graph for tensor.h:

Go to the source code of this file.

Classes

struct  madness::archive::ArchiveLoadImpl< Archive, Tensor< T > >
 Deserialize a tensor ... existing tensor is replaced. More...
struct  madness::archive::ArchiveStoreImpl< Archive, Tensor< T > >
 Serialize a tensor. More...
struct  madness::conditional_conj_struct< Q, iscomplex >
 For real types return value, for complex return conjugate. More...
struct  madness::conditional_conj_struct< Q, true >
 For real types return value, for complex return conjugate. More...
struct  madness::detail::EvalScratch< R >
 Per-thread grow-on-demand buffer pair for general_fast_transform. More...
class  madness::SliceTensor< T >
 Indexing a non-constant tensor with slices returns a SliceTensor. More...
class  madness::Tensor< T >
 A tensor is a multidimensional array. More...

Namespaces

namespace  madness
 Namespace for all elements and tools of MADNESS.
namespace  madness::archive
 Namespace for I/O tools.
namespace  madness::detail
namespace  std

Macros

#define IS_ODD(n)
#define IS_UNALIGNED(p)
#define TENSOR_ALIGNMENT   64
#define TENSOR_SHARED_PTR   std::shared_ptr

Functions

template<class T>
Tensor< typename Tensor< T >::scalar_type > madness::abs (const Tensor< T > &t)
 Return a new tensor holding the absolute value of each element of t.
static long std::abs (long a)
template<class T>
Tensor< typename Tensor< T >::scalar_type > madness::arg (const Tensor< T > &t)
 Return a new tensor holding the argument of each element of t (complex types only).
template<typename Q>
Q madness::conditional_conj (const Q &coeff)
 For real types return value, for complex return conjugate.
template<class T>
Tensor< T > madness::conj (const Tensor< T > &t)
 Returns a new deep copy of the complex conjugate of the input tensor (complex types only).
template<class T>
Tensor< T > madness::conj_transpose (const Tensor< T > &t)
 Returns a new deep copy of the complex conjugate transpose of the input tensor.
template<class Q, class T>
Tensor< Q > madness::convert (const Tensor< T > &t)
 Returns a new contiguous tensor of type Q that is a deep copy of the input.
template<class T>
Tensor< T > madness::copy (const Tensor< T > &t)
 Returns a new contiguous tensor that is a deep copy of the input.
template<typename R>
std::pair< Tensor< R > &, Tensor< R > & > madness::detail::eval_scratch (long need)
template<typename R>
void madness::detail::eval_scratch_clear ()
template<typename R>
thread_specific< EvalScratch< R > > & madness::detail::eval_scratch_pool ()
template<class R>
Tensor< std::complex< R > > & madness::fast_transform (const Tensor< std::complex< R > > &t, const Tensor< R > &c, Tensor< std::complex< R > > &result, Tensor< std::complex< R > > &workspace)
template<class T, class Q>
Tensor< TENSOR_RESULT_TYPE(T, Q) > & madness::fast_transform (const Tensor< T > &t, const Tensor< Q > &c, Tensor< TENSOR_RESULT_TYPE(T, Q) > &result, Tensor< TENSOR_RESULT_TYPE(T, Q) > &workspace)
 Restricted but heavily optimized form of transform().
template<class R>
Tensor< std::complex< R > > & madness::general_fast_transform (const Tensor< std::complex< R > > &t, const Tensor< R > *c, Tensor< std::complex< R > > &result, Tensor< std::complex< R > > &workspace)
 Optimized general_fast_transform for complex tensor * real matrices.
template<class T, class Q>
Tensor< TENSOR_RESULT_TYPE(T, Q)> & madness::general_fast_transform (const Tensor< T > &t, const Tensor< Q > *c, Tensor< TENSOR_RESULT_TYPE(T, Q)> &result, Tensor< TENSOR_RESULT_TYPE(T, Q)> &workspace)
template<class T, class Q>
Tensor< TENSOR_RESULT_TYPE(T, Q)> madness::general_transform (const Tensor< T > &t, const Tensor< Q > c[])
 Transform all dimensions of the tensor t by distinct matrices c.
template<class T>
Tensor< T > madness::identity_matrix (long n)
 Returns the identity matrix of the specified size.
template<class T>
Tensor< typename Tensor< T >::scalar_type > madness::imag (const Tensor< T > &t)
 Return a new tensor holding the imaginary part of each element of t (complex types only).
template<class T, class Q>
Tensor< TENSOR_RESULT_TYPE(T, Q)> madness::inner (const Tensor< T > &left, const Tensor< Q > &right, long k0=-1, long k1=0)
 Inner product ... result(i,j,...,p,q,...) = sum(z) left(i,j,...,z)*right(z,p,q,...).
template<class T, class Q>
void madness::inner_result (const Tensor< T > &left, const Tensor< Q > &right, long k0, long k1, Tensor< TENSOR_RESULT_TYPE(T, Q) > &result)
 Accumulate inner product into user provided, contiguous, correctly sized result tensor.
template<typename T = int>
double madness::detail::mynorm (int t)
template<typename T>
T madness::detail::mynorm (std::complex< T > t)
template<typename T>
T madness::detail::mynorm (T t)
template<typename T, typename Q>
IsSupported< TensorTypeData< Q >, Tensor< T > >::type madness::operator* (const Q &x, const Tensor< T > &t)
 The class defines tensor op scalar ... here define scalar op tensor.
template<typename T, typename Q>
IsSupported< TensorTypeData< Q >, Tensor< T > >::type madness::operator+ (Q x, const Tensor< T > &t)
 The class defines tensor op scalar ... here define scalar op tensor.
template<typename T, typename Q>
IsSupported< TensorTypeData< Q >, Tensor< T > >::type madness::operator- (Q x, const Tensor< T > &t)
 The class defines tensor op scalar ... here define scalar op tensor.
template<class T>
std::ostream & madness::operator<< (std::ostream &s, const Tensor< T > &t)
 Print (for human consumption) a tensor to the stream.
template<class T>
Tensor< T > madness::outer (const Tensor< T > &left, const Tensor< T > &right)
 Outer product ... result(i,j,...,p,q,...) = left(i,k,...)*right(p,q,...).
template<class T>
void madness::outer_result (const Tensor< T > &left, const Tensor< T > &right, Tensor< T > &result)
 Outer product ... result(i,j,...,p,q,...) = left(i,k,...)*right(p,q,...).
template<class T>
Tensor< typename Tensor< T >::scalar_type > madness::real (const Tensor< T > &t)
 Return a new tensor holding the real part of each element of t (complex types only).
template<class T, class Q>
Tensor< TENSOR_RESULT_TYPE(T, Q)> madness::transform (const Tensor< T > &t, const Tensor< Q > &c)
 Transform all dimensions of the tensor t by the matrix c.
template<class T, class Q>
Tensor< TENSOR_RESULT_TYPE(T, Q)> madness::transform_dir (const Tensor< T > &t, const Tensor< Q > &c, int axis)
 Transforms one dimension of the tensor t by the matrix c, returns new contiguous tensor.
template<class T>
Tensor< T > madness::transpose (const Tensor< T > &t)
 Returns a new deep copy of the transpose of the input tensor.

Detailed Description

Defines and implements most of Tensor.

Macro Definition Documentation

◆ IS_ODD

#define IS_ODD ( n)
Value:
((n)&0x1)

◆ IS_UNALIGNED

#define IS_UNALIGNED ( p)
Value:
(((unsigned long)(p))&0x7)
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72

◆ TENSOR_ALIGNMENT

#define TENSOR_ALIGNMENT   64

◆ TENSOR_SHARED_PTR

#define TENSOR_SHARED_PTR   std::shared_ptr