37 Index k, iU, iX, iL, rU, rL;
43 for(
size_t iteration = 0; iteration < _maxIterations; ++iteration) {
48 std::pair<TensorNetwork, TensorNetwork> split = _x.
chop(pos);
49 _x.
component(pos)(rU, iX, rL) = split.first(iU&1, rU)*split.second(rL, iL&1)*
_b(iU^pos, iX, iL&(pos+1));
56 std::pair<TensorNetwork, TensorNetwork> split = _x.
chop(pos);
57 _x.
component(pos)(rU, iX, rL) = split.first(iU&1, rU)*split.second(rL, iL&1)*
_b(iU^pos, iX, iL&(pos+1));
62 if(residual <
EPSILON || (lastResidual-residual)/residual < _eps) {
return; }
63 lastResidual = residual;
std::pair< TensorNetwork, TensorNetwork > chop(const size_t _position) const
Splits the TTNetwork into two parts by removing the node.
Header file for the Index class.
#define XERUS_REQUIRE_TEST
Header file for the IndexedTensorMoveable class.
Header file defining lists of indexed tensors.
void decomposition_als(TTTensor &_x, const Tensor &_b, const double _eps=EPSILON, const size_t _maxIterations=1000)
Tensor & component(const size_t _idx)
Complete access to a specific component of the TT decomposition.
Header file for the classes defining factorisations of Tensors.
The main namespace of xerus.
Class that handles simple (non-decomposed) tensors in a dense or sparse representation.
size_t degree() const
Gets the degree of the TensorNetwork.
void move_core(const size_t _position, const bool _keepRank=false)
Move the core to a new position.
Header file for the decomposition ALS algorithm. This is likely temporary.
constexpr const value_t EPSILON
The default epsilon value in xerus.
static XERUS_force_inline value_t frob_norm(const Tensor &_tensor)
Calculates the frobenius norm of the given tensor.
Header file for shorthand notations that are xerus specific but used throughout the library...
Class used to represent indices that can be used to write tensor calculations in index notation...
Header file for the TensorNetwork class.