125 std::string str=
"confused tensor type";
126 if (tt==
TT_FULL) str=
"full rank tensor";
127 if (tt==
TT_2D) str=
"low rank tensor 2-way";
151 return "unknown tensor type";
153 template <
typename Archive>
173 template<
typename T>
class SRConf;
175 template <
typename T>
176 class GenTensor :
public Tensor<T> {
220 std::string
what_am_i()
const {
return "GenTensor, aliased to Tensor";};
247 typedef typename std::list<GenTensor<T> >::iterator iterT;
249 for (iterT it=++addends.begin(); it!=addends.end(); ++it) {
273 template <
typename R,
typename Q>
290 template <
class Archive,
typename T>
293 if (t.iscontiguous()) {
294 s & t.size() & t.id();
305 template <
class Archive,
typename T>
308 long sz = 0l,
id =0l;
310 if (
id != t.id())
throw "type mismatch deserializing a tensor";
315 if (sz != t.size())
throw "size mismatch deserializing a tensor";
316 s &
wrap(t.ptr(), t.size());
long _dim[TENSOR_MAXDIM]
Size of each dimension.
Definition: basetensor.h:96
long _ndim
Number of dimensions (-1=invalid; 0=no supported; >0=tensor)
Definition: basetensor.h:94
Definition: lowranktensor.h:59
GenTensor & full_tensor()
Definition: gentensor.h:201
bool is_of_tensortype(const TensorType &tt) const
Definition: gentensor.h:225
GenTensor(const TensorType tt)
Definition: gentensor.h:185
GenTensor(std::vector< long > v, const TensorType &tt)
Definition: gentensor.h:186
GenTensor convert(const TensorArgs &targs) const
Definition: gentensor.h:198
const SVDTensor< T > & get_tensortrain() const
Definition: gentensor.h:231
SRConf< T > config() const
Definition: gentensor.h:237
GenTensor full_tensor() const
Definition: gentensor.h:200
GenTensor(const SRConf< T > &sr1)
Definition: gentensor.h:188
const SVDTensor< T > & get_svdtensor() const
Definition: gentensor.h:230
friend GenTensor copy(const GenTensor &other)
deep copy
Definition: lowranktensor.h:283
void add_SVD(const GenTensor< T > &rhs, const double &eps)
Definition: gentensor.h:235
constexpr bool is_full_tensor() const
Definition: gentensor.h:224
GenTensor & get_tensor()
Definition: gentensor.h:204
GenTensor get_tensor() const
Definition: gentensor.h:203
GenTensor reconstruct_tensor() const
Definition: gentensor.h:199
std::string what_am_i() const
Definition: gentensor.h:220
bool has_no_data() const
Definition: gentensor.h:211
Tensor< T > full_tensor_copy()
Definition: gentensor.h:207
size_t real_size() const
Definition: gentensor.h:214
Tensor< T > full_tensor_copy() const
Definition: gentensor.h:206
void normalize()
Definition: gentensor.h:218
GenTensor(const Tensor< T > &t1)
Definition: gentensor.h:182
float_scalar_type normf() const
Definition: lowranktensor.h:406
double svd_normf() const
Definition: gentensor.h:213
constexpr bool is_tensortrain() const
Definition: gentensor.h:223
void reduce_rank(const double &eps)
Definition: gentensor.h:217
long rank() const
Definition: gentensor.h:212
size_t nCoeff() const
Definition: gentensor.h:215
long size() const
Definition: lowranktensor.h:482
SVDTensor< T > & get_svdtensor()
Definition: gentensor.h:228
GenTensor(const Tensor< T > &t1, double eps, const TensorType tt)
Definition: gentensor.h:184
GenTensor()
Definition: gentensor.h:180
GenTensor(std::vector< long > v, const TensorArgs &targs)
Definition: gentensor.h:187
SVDTensor< T > & get_tensortrain()
Definition: gentensor.h:229
TensorType tensor_type() const
Definition: gentensor.h:221
static double fac_reduce()
return the additional safety for rank reduction
Definition: gentensor.h:241
bool has_data() const
Definition: gentensor.h:210
GenTensor(long nd, const long d[], const TensorType &tt)
Definition: gentensor.h:189
GenTensor(const Tensor< T > &t1, const TensorArgs &targs)
Definition: gentensor.h:183
SRConf< T > get_configs(const int &start, const int &end) const
Definition: gentensor.h:238
bool is_assigned() const
Definition: gentensor.h:209
constexpr bool is_svd_tensor() const
Definition: gentensor.h:222
Definition: SVDTensor.h:42
A tensor is a multidimension array.
Definition: tensor.h:317
const TensorIterator< T > & end() const
End point for forward iteration.
Definition: tensor.h:1876
static const double R
Definition: csqrt.cc:46
auto T(World &world, response_space &f) -> response_space
Definition: global_functions.cc:34
archive_array< T > wrap(const T *, unsigned int)
Factory function to wrap a dynamically allocated pointer as a typed archive_array.
Definition: archive.h:913
static const double v
Definition: hatom_sf_dirac.cc:20
double tt1
Definition: lapack.cc:62
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition: madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition: madness_exception.h:134
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
GenTensor< TENSOR_RESULT_TYPE(R, Q)> general_transform(const GenTensor< R > &t, const Tensor< Q > c[])
Definition: gentensor.h:274
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition: mra.h:2002
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition: lowrankfunction.h:397
void change_tensor_type(GenTensor< T > &t, const TensorArgs &targs)
change representation to targ.tt
Definition: gentensor.h:284
TENSOR_RESULT_TYPE(T, R) inner(const Function< T
Computes the scalar/inner product between two functions.
Definition: vmra.h:1059
TensorType
low rank representations of tensors (see gentensor.h)
Definition: gentensor.h:120
@ TT_TENSORTRAIN
Definition: gentensor.h:120
@ TT_2D
Definition: gentensor.h:120
@ TT_FULL
Definition: gentensor.h:120
GenTensor< T > reduce(std::list< GenTensor< T > > &addends, double eps, bool are_optimal=false)
add all the GenTensors of a given list
Definition: gentensor.h:246
std::enable_if< std::is_base_of< ProjectorBase, projT >::value, OuterProjector< projT, projQ > >::type outer(const projT &p0, const projQ &p1)
Definition: projector.h:457
double Q(double a)
Definition: relops.cc:20
static const double c
Definition: relops.cc:10
TensorArgs holds the arguments for creating a LowRankTensor.
Definition: gentensor.h:134
void serialize(const Archive &ar)
Definition: gentensor.h:154
static std::string what_am_i(const TensorType &tt)
Definition: gentensor.h:147
double thresh
Definition: gentensor.h:135
TensorArgs(const double &thresh1, const TensorType &tt1)
Definition: gentensor.h:138
TensorArgs()
Definition: gentensor.h:137
TensorArgs(const TensorType &tt1, const double &thresh1)
Definition: gentensor.h:142
TensorType tt
Definition: gentensor.h:136
static void load(const Archive &s, GenTensor< T > &t)
Definition: gentensor.h:307
Default load of an object via serialize(ar, t).
Definition: archive.h:666
static void store(const Archive &s, const GenTensor< T > &t)
Definition: gentensor.h:292
Default store of an object via serialize(ar, t).
Definition: archive.h:611
Defines and implements most of Tensor.
#define BINARY_OPTIMIZED_ITERATOR(X, x, Y, y, exp)
Definition: tensor_macros.h:701
#define TENSOR_MAXDIM
Definition: tensor_macros.h:194
Defines and implements the tensor train decomposition as described in I.V. Oseledets,...
void d()
Definition: test_sig.cc:79