MADNESS
version 0.9
|
#include <tensortrain.h>
Public Member Functions | |
TensorTrain (const Tensor< T > &t, double eps) | |
ctor for a TensorTrain, with the tolerance eps More... | |
TensorTrain (const Tensor< T > &t, double eps, const std::vector< long > dims) | |
ctor for a TensorTrain, with the tolerance eps More... | |
void | decompose (const Tensor< T > &t, double eps, const std::vector< long > &dims) |
decompose the input tensor into a TT representation More... | |
TensorTrain< T > & | operator+= (const TensorTrain< T > &rhs) |
inplace addition of two Tensortrains; will increase ranks of this More... | |
void | fusedim (const long i) |
merge two dimensions into one More... | |
Tensor< T > | reconstruct (const bool flat=false) const |
reconstruct this to a full representation More... | |
void | two_mode_representation (Tensor< T > &U, Tensor< T > &VT, Tensor< typename Tensor< T >::scalar_type > &s) |
construct a two-mode representation (aka unnormalized SVD) More... | |
void | truncate (double eps) |
recompress and truncate this TT representation More... | |
long | ndim () const |
return the number of dimensions More... | |
long | size () const |
return the number of coefficients in all core tensors More... | |
long | real_size () const |
return the size of this instance, including static memory for vectors and such More... | |
long | dim (const int i) const |
return the number of entries in dimension i More... | |
bool | is_zero_rank () const |
if rank is zero More... | |
std::vector< long > | ranks () const |
return the TT ranks More... | |
A tensor train is a multi-modal representation of a tensor t
The "core" tensors G are connected via a linear index network, where the first index a1 and the last index a5 are boundary indices and are set to 1.
The tensor train representation is suited for any number of dimensions and in general at least as fast as the 2-way decomposition SVD. If the tensor has full rank it will need about twice the storage space of the full tensor
|
inline |
ctor for a TensorTrain, with the tolerance eps
The tensor train will represent the input tensor with accuracy || t - this ||_2 < eps
Note that we rely on specific layout of the memory in the tensors, e.g. we pass SliceTensors on to lapack. This will only work if the slices are contiguous.
[in] | t | full representation of a tensor |
[in] | eps | the accuracy threshold |
References madness::TensorTrain< T >::decompose().
|
inline |
ctor for a TensorTrain, with the tolerance eps
The tensor train will represent the input tensor with accuracy || t - this ||_2 < eps
Note that we rely on specific layout of the memory in the tensors, e.g. we pass SliceTensors on to lapack. This will only work if the slices are contiguous.
[in] | t | full representation of a tensor |
[in] | eps | the accuracy threshold |
[in] | dims | the tt structure |
References madness::TensorTrain< T >::decompose().
|
inline |
decompose the input tensor into a TT representation
[in] | t | tensor in full rank |
[in] | eps | the precision threshold |
[in] | dims | the tt structure |
References b(), c, madness::copy(), k, max, madness::SRConf< T >::max_sigma(), mpfr::min(), madness::print(), sqrt(), madness::svd_result(), and std::tr1::T().
Referenced by madness::TensorTrain< T >::TensorTrain().
|
inline |
return the number of entries in dimension i
Referenced by madness::TensorTrain< T >::ranks(), madness::TensorTrain< T >::reconstruct(), and madness::TensorTrain< T >::truncate().
|
inline |
merge two dimensions into one
merge dimension i and i+1 into new dimension i
[in] | i | the first dimension |
References madness::inner().
|
inline |
if rank is zero
|
inline |
return the number of dimensions
Referenced by madness::TensorTrain< T >::operator+=(), madness::TensorTrain< T >::reconstruct(), madness::TensorTrain< T >::truncate(), and madness::TensorTrain< T >::two_mode_representation().
|
inline |
inplace addition of two Tensortrains; will increase ranks of this
inefficient if many additions are performed, since it requires many calls of new.
[in] | rhs | a TensorTrain to be added |
References k, and madness::TensorTrain< T >::ndim().
|
inline |
return the TT ranks
References madness::TensorTrain< T >::dim().
|
inline |
return the size of this instance, including static memory for vectors and such
References madness::TensorTrain< T >::size(), and std::tr1::T().
|
inline |
reconstruct this to a full representation
[in] | flat | return this in flat representation |
References madness::TensorTrain< T >::dim(), madness::inner(), madness::TensorTrain< T >::ndim(), and madness::TensorTrain< T >::size().
|
inline |
return the number of coefficients in all core tensors
Referenced by madness::TensorTrain< T >::real_size(), madness::TensorTrain< T >::reconstruct(), and madness::TensorTrain< T >::truncate().
|
inline |
recompress and truncate this TT representation
[in] | eps | the truncation threshold |
References madness::copy(), madness::TensorTrain< T >::dim(), madness::inner(), madness::lq(), madness::SRConf< T >::max_sigma(), mpfr::min(), madness::TensorTrain< T >::ndim(), R, madness::TensorTrain< T >::size(), sqrt(), madness::svd(), and TENSOR_MAXDIM.
|
inline |
construct a two-mode representation (aka unnormalized SVD)
[out] | U({i},rank) | the left singular vectors |
[out] | VT(rank,{i}) | the right singular vectors |
[out] | s(rank) | vector holding 1's |
References madness::inner(), and madness::TensorTrain< T >::ndim().