|
MADNESS 0.10.1
|
#include <SVDTensor.h>


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 | |
| SVDTensor< T > & | emul (const SVDTensor< T > &other) |
| SVDTensor< T > & | gaxpy (T alpha, const SVDTensor< T > &rhs, T beta) |
| long | nCoeff () const |
| SVDTensor & | operator= (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 | |
| void | truncate_svd (const double &thresh) |
| Public Member Functions inherited from madness::SRConf< T > | |
| SRConf () | |
| default ctor | |
| 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 | |
| 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 | |
| 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 | |
| ~SRConf () | |
| dtor | |
| void | add_SVD (const SRConf< T > &rhs, const double &thresh) |
| add two orthonormal configurations, yielding an optimal SVD decomposition | |
| void | append (const SRConf< T > &rhs, const double fac=1.0) |
| append configurations of rhs to this | |
| 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 | |
| void | clear () |
| SRConf< T > | copy_slice (const std::array< Slice, TENSOR_MAXDIM > &s) const |
| return a slice of this (deep copy) | |
| int | dim_per_vector (int idim) const |
| return the number of physical dimensions | |
| SRConf< T > & | emul (const SRConf< T > &other) |
| perform elementwise Hadamard product | |
| Tensor< T > | flat_vector (const unsigned int &idim) |
| return shallow copy of a slice of one of the vectors, flattened to (r,kVec) | |
| const Tensor< T > | flat_vector (const unsigned int &idim) const |
| return shallow copy of a slice of one of the vectors, flattened to (r,kVec) | |
| Tensor< T > | flat_vector_with_weights (const int dim) const |
| return flat (r,i) view of the tensor with the weights multiplied in | |
| 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? | |
| bool | has_no_data () const |
| does this have any data? | |
| bool | has_structure () const |
| return if this has a tensor structure (has not been flattened) | |
| 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 | |
| Tensor< T > | make_vector_with_weights (const int dim) const |
| SRConf & | operator= (const SRConf &rhs) |
| assignment operator (tested), shallow copy of vectors | |
| SRConf & | operator= (const T &number) |
| assign a number to this; | |
| long | rank () const |
| return the logicalrank | |
| Tensor< T > | reconstruct () const |
| reconstruct this to return a full tensor | |
| Tensor< T > & | ref_vector (const unsigned int &idim) |
| return reference to one of the vectors F | |
| const Tensor< T > & | ref_vector (const unsigned int &idim) const |
| return reference to one of the vectors F | |
| 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< T > | transform_dir (const Tensor< T > &c, const int &axis) const |
| double | weights (const unsigned int &i) const |
| return the weight | |
| 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. | |
| long | dim (int i) const |
Returns the size of dimension i. | |
| const long * | dims () const |
| Returns the array of tensor dimensions. | |
| long | id () const |
Returns the typeid of the tensor (c.f., TensorTypeData<T> ). | |
| bool | iscontiguous () const |
| Returns true if the tensor refers to contiguous memory locations. | |
| long | ndim () const |
| Returns the number of dimensions in the tensor. | |
| long | size () const |
| Returns the number of elements in the tensor. | |
| long | stride (int i) const |
Returns the stride associated with dimension i. | |
| const long * | strides () const |
| Returns the array of tensor strides. | |
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 | |
| static SVDTensor | compute_svd (const Tensor< T > &tensor, const double &eps, std::array< long, 2 > vectordim={0, 0}) |
| reduce the rank using SVD | |
| static SVDTensor | compute_svd_from_range (const Tensor< T > &range, const Tensor< T > &matrix) |
| compute an SVD from a given matrix and its range | |
| static SVDTensor< T > | concatenate (const std::list< SVDTensor< T > > &addends) |
| concatenate all arguments into a single SRConf (i.e. adding them all up) | |
| 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. | |
Friends | |
| SVDTensor< T > | copy (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< T > | reduce (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< T > | tensorT |
| 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 | |
| std::vector< Slice > | s0 |
| std::vector< Slice > | s1 |
| std::array< Tensor< T >, 2 > | vector_ |
| Tensor< typename Tensor< T >::scalar_type > | weights_ |
| for each configuration the weight; length should be r | |
| Static Public Attributes inherited from madness::SRConf< T > | |
| static const long | check_orthonormality_frequency = 100000 |
| check orthonormality at low rank additions at every xth addition | |
| Protected Member Functions inherited from madness::SRConf< T > | |
| bool | check_dimensions () const |
| bool | check_vector_orthonormality (const int ivec) const |
| check if the terms are orthogonal | |
| 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) | |
| bool | is_flat () const |
| return if this has only one additional dimension (apart from rank) | |
| Tensor< T > | make_left_vector_with_weights () const |
| void | make_slices () |
| redo the Slices for getting direct access to the configurations | |
| 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 | |
| void | normalize () |
| normalize the vectors (tested) | |
| TensorTypeData< T >::float_scalar_type | normf () const |
| calculate the Frobenius norm | |
| size_t | real_size () const |
| return the real size of this | |
| void | scale (const double &fac) |
| scale this by a number | |
| void | scale (const double_complex &fac) |
| TensorTypeData< T >::float_scalar_type | svd_normf () const |
| calculate the Frobenius norm, if this is in SVD form | |
| template<typename Q> | |
| std::enable_if<!(TensorTypeData< T >::iscomplexorTensorTypeData< Q >::iscomplex), TENSOR_RESULT_TYPE(T, Q)>::type friend | trace (const SRConf< T > &rhs, const SRConf< Q > &lhs) |
| calculate the Frobenius inner product (tested) | |
| template<typename Q> | |
| std::enable_if<(TensorTypeData< T >::iscomplexorTensorTypeData< Q >::iscomplex), TENSOR_RESULT_TYPE(T, Q)>::type friend | trace (const SRConf< T > &rhs, const SRConf< Q > &lhs) |
| SRConf< T > | transform (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. | |
| void | flat_inplace () |
| Reshapes the tensor inplace into 1D. | |
| void | fusedim_inplace (long i) |
Fuses dimensions i and i+1. | |
| void | mapdim_inplace (const std::vector< long > &map) |
| General permutation of dimensions. | |
| void | reshape_inplace (const std::vector< long > &d) |
| Reshapes the tensor inplace. | |
| void | reshape_inplace (int ndimnew, const long *d) |
| Reshapes the tensor inplace. | |
| void | set_dims_and_size (long nd, const long d[]) |
| void | splitdim_inplace (long i, long dimi0, long dimi1) |
Splits dimension i. | |
| void | swapdim_inplace (long i, long j) |
| Swaps the dimensions. | |
| Protected Attributes inherited from madness::BaseTensor | |
| long | _dim [TENSOR_MAXDIM] |
| Size of each dimension. | |
| long | _id |
| Id from TensorTypeData<T> in type_data.h. | |
| long | _ndim |
| Number of dimensions (-1=invalid; 0=no supported; >0=tensor). | |
| long | _size |
| Number of elements in the tensor. | |
| long | _stride [TENSOR_MAXDIM] |
| Increment between elements in each dimension. | |
|
inline |
References madness::SRConf< T >::SRConf().
Referenced by SVDTensor(), compute_randomized_svd(), compute_svd(), compute_svd_from_range(), concatenate(), copy, divide_and_conquer_reduce(), emul(), gaxpy(), general_transform, operator=(), outer, reduce, transform, and transform_dir.
|
inline |
References compute_randomized_svd(), and madness::Tensor< T >::has_data().
|
default |
References SVDTensor().
|
inline |
References madness::SRConf< T >::SRConf().
|
inline |
|
inline |
References madness::SRConf< T >::SRConf(), and madness::BaseTensor::dims().
|
inline |
|
static |
reduce the rank using SVD
References SVDTensor(), madness::RandomizedMatrixDecomposition< T >::compute_range(), compute_svd(), compute_svd_from_range(), madness::BaseTensor::dims(), madness::RandomizedMatrixDecomposition< T >::exceeds_maxrank(), MADNESS_ASSERT, madness::RMDFactory::maxrank(), madness::BaseTensor::ndim(), madness::print(), Q(), madness::BaseTensor::size(), truncate_svd(), and madness::wall_time().
Referenced by SVDTensor().
|
static |
reduce the rank using SVD
References SVDTensor(), madness::_(), madness::copy(), madness::BaseTensor::dims(), madness::FunctionDefaults< NDIM >::thresh, madness::SRConf< T >::max_sigma(), madness::BaseTensor::ndim(), madness::Tensor< T >::normf(), madness::RandomizedMatrixDecomposition< T >::resize_to_matrix(), madness::SRConf< T >::set_vectors_and_weights(), madness::svd(), and madness::transpose().
Referenced by compute_randomized_svd().
|
static |
compute an SVD from a given matrix and its range
following Alg. 5.1 of HMT 2011
References SVDTensor(), madness::conj(), madness::conj_transpose(), madness::copy(), madness::BaseTensor::dims(), madness::inner(), MADNESS_ASSERT, madness::BaseTensor::ndim(), Q(), madness::RandomizedMatrixDecomposition< T >::resize_to_matrix(), madness::SRConf< T >::set_vectors_and_weights(), madness::BaseTensor::size(), and madness::svd().
Referenced by compute_randomized_svd(), and test_stuff().
|
inlinestatic |
concatenate all arguments into a single SRConf (i.e. adding them all up)
References madness::SRConf< T >::SRConf(), SVDTensor(), madness::_(), a, madness::SRConf< T >::compatible, MADNESS_ASSERT, madness::SRConf< T >::make_vector_dimensions(), madness::SRConf< T >::nci_left, madness::BaseTensor::ndim(), madness::Tensor< T >::reshape(), madness::SRConf< T >::set_vectors_and_weights(), madness::BaseTensor::size(), madness::SRConf< T >::weights(), and madness::weights.
Referenced by reduce.
| void madness::SVDTensor< T >::divide_and_conquer_reduce | ( | const double & | thresh | ) |
reduce the rank using a divide-and-conquer approach
References SVDTensor(), madness::SRConf< T >::add_SVD(), divide_and_conquer_reduce(), madness::FunctionDefaults< NDIM >::thresh, madness::SRConf< T >::get_configs(), madness::SRConf< T >::has_no_data(), madness::SRConf< T >::has_structure(), MADNESS_ASSERT, madness::normalize(), madness::orthonormalize(), and rank().
Referenced by divide_and_conquer_reduce(), and reduce.
|
inline |
References madness::SRConf< T >::SRConf(), SVDTensor(), and madness::SRConf< T >::emul().
|
inline |
References SVDTensor(), alpha, madness::SRConf< T >::append(), beta, and madness::SRConf< T >::scale().
|
inline |
References madness::SRConf< T >::nCoeff().
|
inline |
References madness::SRConf< T >::SRConf(), and SVDTensor().
| void madness::SVDTensor< T >::orthonormalize | ( | const double & | thresh | ) |
References madness::SRConf< T >::flat_vector(), madness::FunctionDefaults< NDIM >::thresh, madness::SRConf< T >::has_no_data(), madness::SRConf< T >::make_structure(), madness::normalize(), madness::ortho3(), rank(), madness::SRConf< T >::vector_, madness::SRConf< T >::weights(), and madness::SRConf< T >::weights_.
| void madness::SVDTensor< T >::orthonormalize_random | ( | const double & | thresh | ) |
References madness::RandomizedMatrixDecomposition< T >::compute_range(), madness::SRConf< T >::flat_vector(), madness::SRConf< T >::has_no_data(), madness::SRConf< T >::kVec(), madness::SRConf< T >::make_left_vector_with_weights(), madness::RMDFactory::maxrank(), madness::normalize(), Q(), rank(), recompute_from_range(), and truncate_svd().
Referenced by reduce.
|
inline |
References madness::SRConf< T >::rank().
Referenced by divide_and_conquer_reduce(), orthonormalize(), orthonormalize_random(), test_stuff(), madness::FunctionImpl< T, NDIM >::tnorm(), and truncate_svd().
| 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::SRConf< T >::flat_vector(), madness::inner(), MADNESS_ASSERT, madness::SRConf< T >::make_left_vector_with_weights(), Q(), madness::SRConf< T >::set_vectors_and_weights(), and madness::svd().
Referenced by orthonormalize_random().
|
static |
References madness::reduction_alg.
Referenced by reduce.
|
static |
References madness::reduction_alg.
| void madness::SVDTensor< T >::truncate_svd | ( | const double & | thresh | ) |
References madness::SRConf< T >::SRConf(), SVDTensor(), and copy.
Referenced by copy.
|
friend |
References SVDTensor(), c, general_transform, Q(), and R.
Referenced by general_transform.
|
friend |
References SVDTensor(), Q(), and R.
|
friend |
References SVDTensor(), axis, c, Q(), R, and transform_dir.
Referenced by transform_dir.