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

#include <SVDTensor.h>

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

Public Member Functions

 SVDTensor ()
 
 SVDTensor (const long ndims, const long *dims)
 
 SVDTensor (const SRConf< T > &rhs)
 
 SVDTensor (const std::vector< long > &dims)
 
 SVDTensor (const SVDTensor< T > &rhs)=default
 
 SVDTensor (const Tensor< double > &weights, const Tensor< T > &vector1, const Tensor< T > &vector2, const long &ndim, const long *dims)
 
 SVDTensor (const Tensor< T > &rhs, const double eps)
 
void divide_and_conquer_reduce (const double &thresh)
 reduce the rank using a divide-and-conquer approach More...
 
SVDTensor< T > & emul (const SVDTensor< T > &other)
 
SVDTensor< T > & gaxpy (T alpha, const SVDTensor< T > &rhs, T beta)
 
long nCoeff () const
 
SVDTensoroperator= (const T &number)
 
void orthonormalize (const double &thresh)
 
void orthonormalize_random (const double &thresh)
 
long rank () const
 
void recompute_from_range (const Tensor< T > &range)
 compute an SVD from a given matrix and its range More...
 
void truncate_svd (const double &thresh)
 
- Public Member Functions inherited from madness::SRConf< T >
 SRConf ()
 default ctor More...
 
 SRConf (const long &ndim, const long *dimensions, const long nci)
 
 SRConf (const long &ndim, const std::array< long, TENSOR_MAXDIM > &dimensions, const long nci)
 
 SRConf (const SRConf &rhs)=default
 copy ctor (tested); shallow copy More...
 
 SRConf (const Tensor< double > &weights, const std::vector< Tensor< T > > &vectors, const long &ndim, const long &dims, const long nci)
 ctor with provided weights and effective vectors; shallow copy More...
 
 SRConf (const Tensor< double > &weights, const tensorT &vector1, const tensorT &vector2, const long &ndim, const long *dims, const long nci)
 explicit ctor with two vectors (aka SVD), shallow More...
 
 ~SRConf ()
 dtor More...
 
void add_SVD (const SRConf< T > &rhs, const double &thresh)
 add two orthonormal configurations, yielding an optimal SVD decomposition More...
 
void append (const SRConf< T > &rhs, const double fac=1.0)
 append configurations of rhs to this More...
 
void append (const SRConf< T > &rhs, const double_complex fac=1.0)
 
const std::vector< Slice > & c0 (const int idim) const
 return a Slice that corresponds the that part of vector_ that holds coefficients More...
 
void clear ()
 
SRConf< Tcopy_slice (const std::array< Slice, TENSOR_MAXDIM > &s) const
 return a slice of this (deep copy) More...
 
int dim_per_vector (int idim) const
 return the number of physical dimensions More...
 
SRConf< T > & emul (const SRConf< T > &other)
 perform elementwise Hadamard product More...
 
Tensor< Tflat_vector (const unsigned int &idim)
 return shallow copy of a slice of one of the vectors, flattened to (r,kVec) More...
 
const Tensor< Tflat_vector (const unsigned int &idim) const
 return shallow copy of a slice of one of the vectors, flattened to (r,kVec) More...
 
Tensor< Tflat_vector_with_weights (const int dim) const
 return flat (r,i) view of the tensor with the weights multiplied in More...
 
template<typename Q >
SRConf< TENSOR_RESULT_TYPE(T, Q) > general_transform (const Tensor< Q > c[]) const
 
const SRConf get_configs (const int &start, const int &end) const
 
bool has_data () const
 does this have any data? More...
 
bool has_no_data () const
 does this have any data? More...
 
bool has_structure () const
 return if this has a tensor structure (has not been flattened) More...
 
long kVec (const int idim) const
 
void make_empty_vectors_and_weights (const long rank)
 
std::array< std::array< long, TENSOR_MAXDIM >, 2 > make_vector_dimensions (const long rank) const
 deduce the dimensions of the left and right singular vectors from the tensor dimensions More...
 
Tensor< Tmake_vector_with_weights (const int dim) const
 
SRConfoperator= (const SRConf &rhs)
 assignment operator (tested), shallow copy of vectors More...
 
SRConfoperator= (const T &number)
 assign a number to this; More...
 
long rank () const
 return the logicalrank More...
 
Tensor< Treconstruct () const
 reconstruct this to return a full tensor More...
 
Tensor< T > & ref_vector (const unsigned int &idim)
 return reference to one of the vectors F More...
 
const Tensor< T > & ref_vector (const unsigned int &idim) const
 return reference to one of the vectors F More...
 
template<typename Archive >
void serialize (Archive &ar)
 
void set_size_and_dim (long ndim, long k)
 
void set_vectors_and_weights (const Tensor< typename Tensor< T >::scalar_type > &weights, const Tensor< T > &vector1, const Tensor< T > &vector2)
 
SRConf< Ttransform_dir (const Tensor< T > &c, const int &axis) const
 
double weights (const unsigned int &i) const
 return the weight 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 SVDTensor compute_randomized_svd (const Tensor< T > &tensor, const double &eps, std::array< long, 2 > vectordim={0, 0})
 reduce the rank using SVD More...
 
static SVDTensor compute_svd (const Tensor< T > &tensor, const double &eps, std::array< long, 2 > vectordim={0, 0})
 reduce the rank using SVD More...
 
static SVDTensor compute_svd_from_range (const Tensor< T > &range, const Tensor< T > &matrix)
 compute an SVD from a given matrix and its range More...
 
static SVDTensor< Tconcatenate (const std::list< SVDTensor< T > > &addends)
 concatenate all arguments into a single SRConf (i.e. adding them all up) More...
 
static std::string reduction_algorithm ()
 
static void set_reduction_algorithm (const std::string alg)
 
- Static Public Member Functions inherited from madness::SRConf< T >
static int max_sigma (const double &thresh, const long &rank, const Tensor< double > &w)
 
- 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...
 

Friends

SVDTensor< Tcopy (const SVDTensor< T > &rhs)
 
template<typename R , typename Q >
SVDTensor< TENSOR_RESULT_TYPE(R, Q)> general_transform (const SVDTensor< R > &t, const Tensor< Q > c[])
 
template<typename R , typename Q >
SVDTensor< TENSOR_RESULT_TYPE(R, Q)> outer (const SVDTensor< R > &t1, const SVDTensor< Q > &t2)
 
SVDTensor< Treduce (std::list< SVDTensor< T > > &addends, double eps)
 
template<typename R , typename Q >
SVDTensor< TENSOR_RESULT_TYPE(R, Q)> transform (const SVDTensor< R > &t, const Tensor< Q > &c)
 
template<typename R , typename Q >
SVDTensor< TENSOR_RESULT_TYPE(R, Q)> transform_dir (const SVDTensor< R > &t, const Tensor< Q > &c, const int axis)
 

Additional Inherited Members

- Public Types inherited from madness::SRConf< T >
typedef Tensor< TtensorT
 
- Public Attributes inherited from madness::SRConf< T >
long nci_left =-1
 separation dimensions: A(n,m) -> A(r,n) B(r,m), with n={k1,k2},m={k3,k4,k5..) multi-indices More...
 
std::vector< Slices0
 
std::vector< Slices1
 
std::array< Tensor< T >, 2 > vector_
 
Tensor< typename Tensor< T >::scalar_typeweights_
 for each configuration the weight; length should be r More...
 
- Static Public Attributes inherited from madness::SRConf< T >
static const bool check_orthonormality =false
 check orthonormality at low rank additions More...
 
- Protected Member Functions inherited from madness::SRConf< T >
bool check_dimensions () const
 
bool check_right_orthonormality () const
 check if the terms are orthogonal More...
 
void fillWithRandom (const long &rank=1)
 fill this SRConf with 1 flattened random configurations (tested) More...
 
void inplace_add (const SRConf< T > &rhs, std::array< Slice, TENSOR_MAXDIM > lhs_s, std::array< Slice, TENSOR_MAXDIM > rhs_s, const double alpha, const double beta)
 alpha * this(lhs_s) + beta * rhs(rhs_s) More...
 
bool is_flat () const
 return if this has only one additional dimension (apart from rank) More...
 
Tensor< Tmake_left_vector_with_weights () const
 
void make_slices ()
 redo the Slices for getting direct access to the configurations More...
 
std::array< std::vector< Slice >, 2 > make_slices (const std::array< Slice, TENSOR_MAXDIM > &s) const
 
void make_structure (bool force=false)
 
unsigned int nCoeff () const
 return the number of coefficients More...
 
void normalize ()
 normalize the vectors (tested) More...
 
TensorTypeData< T >::float_scalar_type normf () const
 calculate the Frobenius norm More...
 
size_t real_size () const
 return the real size of this More...
 
void scale (const double &fac)
 scale this by a number More...
 
void scale (const double_complex &fac)
 
TensorTypeData< T >::float_scalar_type svd_normf () const
 calculate the Frobenius norm, if this is in SVD form More...
 
template<typename Q >
std::enable_if<(TensorTypeData< T >::iscomplex or TensorTypeData< Q >::iscomplex), TENSOR_RESULT_TYPE(T, Q)>::type friend trace (const SRConf< T > &rhs, const SRConf< Q > &lhs)
 
template<typename Q >
std::enable_if<!(TensorTypeData< T >::iscomplex or TensorTypeData< Q >::iscomplex), TENSOR_RESULT_TYPE(T, Q)>::type friend trace (const SRConf< T > &rhs, const SRConf< Q > &lhs)
 calculate the Frobenius inner product (tested) More...
 
SRConf< Ttransform (const Tensor< T > &c) const
 
- 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 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...
 

Constructor & Destructor Documentation

◆ SVDTensor() [1/7]

template<typename T >
madness::SVDTensor< T >::SVDTensor ( )
inline

◆ SVDTensor() [2/7]

template<typename T >
madness::SVDTensor< T >::SVDTensor ( const Tensor< T > &  rhs,
const double  eps 
)
inline

◆ SVDTensor() [3/7]

template<typename T >
madness::SVDTensor< T >::SVDTensor ( const SVDTensor< T > &  rhs)
default

◆ SVDTensor() [4/7]

template<typename T >
madness::SVDTensor< T >::SVDTensor ( const SRConf< T > &  rhs)
inline

◆ SVDTensor() [5/7]

template<typename T >
madness::SVDTensor< T >::SVDTensor ( const std::vector< long > &  dims)
inline

◆ SVDTensor() [6/7]

template<typename T >
madness::SVDTensor< T >::SVDTensor ( const long  ndims,
const long *  dims 
)
inline

◆ SVDTensor() [7/7]

template<typename T >
madness::SVDTensor< T >::SVDTensor ( const Tensor< double > &  weights,
const Tensor< T > &  vector1,
const Tensor< T > &  vector2,
const long &  ndim,
const long *  dims 
)
inline

Member Function Documentation

◆ compute_randomized_svd()

template<typename T >
SVDTensor< T > madness::SVDTensor< T >::compute_randomized_svd ( const Tensor< T > &  tensor,
const double &  eps,
std::array< long, 2 >  vectordim = {0,0} 
)
static

◆ compute_svd()

template<typename T >
SVDTensor< T > madness::SVDTensor< T >::compute_svd ( const Tensor< T > &  tensor,
const double &  eps,
std::array< long, 2 >  vectordim = {0,0} 
)
static

◆ compute_svd_from_range()

template<typename T >
SVDTensor< T > madness::SVDTensor< T >::compute_svd_from_range ( const Tensor< T > &  range,
const Tensor< T > &  matrix 
)
static

◆ concatenate()

template<typename T >
static SVDTensor<T> madness::SVDTensor< T >::concatenate ( const std::list< SVDTensor< T > > &  addends)
inlinestatic

◆ divide_and_conquer_reduce()

template<typename T >
void madness::SVDTensor< T >::divide_and_conquer_reduce ( const double &  thresh)

◆ emul()

template<typename T >
SVDTensor<T>& madness::SVDTensor< T >::emul ( const SVDTensor< T > &  other)
inline

◆ gaxpy()

template<typename T >
SVDTensor<T>& madness::SVDTensor< T >::gaxpy ( T  alpha,
const SVDTensor< T > &  rhs,
T  beta 
)
inline

◆ nCoeff()

template<typename T >
long madness::SVDTensor< T >::nCoeff ( ) const
inline

◆ operator=()

template<typename T >
SVDTensor& madness::SVDTensor< T >::operator= ( const T number)
inline

◆ orthonormalize()

template<typename T >
void madness::SVDTensor< T >::orthonormalize ( const double &  thresh)

◆ orthonormalize_random()

template<typename T >
void madness::SVDTensor< T >::orthonormalize_random ( const double &  thresh)

◆ rank()

template<typename T >
long madness::SVDTensor< T >::rank ( ) const
inline

◆ recompute_from_range()

template<typename T >
void madness::SVDTensor< T >::recompute_from_range ( const Tensor< T > &  range)

compute an SVD from a given matrix and its range

following Alg. 5.1 of HMT 2011

References madness::conj(), madness::conj_transpose(), madness::copy(), madness::inner(), MADNESS_ASSERT, Q(), and madness::svd().

◆ reduction_algorithm()

template<typename T >
std::string madness::SVDTensor< T >::reduction_algorithm
static

◆ set_reduction_algorithm()

template<typename T >
void madness::SVDTensor< T >::set_reduction_algorithm ( const std::string  alg)
static

◆ truncate_svd()

template<typename T >
void madness::SVDTensor< T >::truncate_svd ( const double &  thresh)

Friends And Related Function Documentation

◆ copy

template<typename T >
SVDTensor<T> copy ( const SVDTensor< T > &  rhs)
friend

◆ general_transform

template<typename T >
template<typename R , typename Q >
SVDTensor<TENSOR_RESULT_TYPE(R,Q)> general_transform ( const SVDTensor< R > &  t,
const Tensor< Q c[] 
)
friend

◆ outer

template<typename T >
template<typename R , typename Q >
SVDTensor<TENSOR_RESULT_TYPE(R,Q)> outer ( const SVDTensor< R > &  t1,
const SVDTensor< Q > &  t2 
)
friend

◆ reduce

template<typename T >
SVDTensor<T> reduce ( std::list< SVDTensor< T > > &  addends,
double  eps 
)
friend

◆ transform

template<typename T >
template<typename R , typename Q >
SVDTensor<TENSOR_RESULT_TYPE(R,Q)> transform ( const SVDTensor< R > &  t,
const Tensor< Q > &  c 
)
friend

◆ transform_dir

template<typename T >
template<typename R , typename Q >
SVDTensor<TENSOR_RESULT_TYPE(R,Q)> transform_dir ( const SVDTensor< R > &  t,
const Tensor< Q > &  c,
const int  axis 
)
friend

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