5 template<
bool isOperator>
11 const double alpha = _accuracy;
16 double tau = (1-alpha)*alpha*Xn*Xn/(2.0*
double(_T.
degree()-1));
28 Xn = std::max(X[yMaxPos], (1-(1-alpha)*alpha/2.0)*Xn*Xn);
33 tau = (1-alpha)*alpha*Xn*Xn/(2.0*
double(_T.
degree()-1));
38 const size_t numComponents = _T.
degree()/(isOperator?2:1);
41 for(
size_t c = 0; c < numComponents; ++c) {
46 for(
size_t i = 1; i < localSize; ++i) {
51 position += maxPos*factor;
size_t find_largest_entry(const TTNetwork< isOperator > &_T, double _accuracy, value_t _lowerBound=0.0)
Finds the position of the approximately largest entry.
Header file for the TT largest entry algorithm.
void soft_threshold(const double _tau, const bool _preventZero=false)
Applies the soft threshholding operation to all ranks.
Specialized TensorNetwork class used to represent TTTensor and TToperators.
The main namespace of xerus.
size_t degree() const
Gets the degree of the TensorNetwork.
std::vector< size_t > ranks() const
Gets the ranks of the TTNetwork.
double value_t
The type of values to be used by xerus.
virtual value_t frob_norm() const override
Calculates the frobenious norm of the TensorNetwork.
virtual void require_correct_format() const override
Tests whether the network resembles that of a TTTensor and checks consistency with the underlying ten...
Tensor entrywise_product(const Tensor &_A, const Tensor &_B)
calculates the entrywise product of two Tensors
void round(const std::vector< size_t > &_maxRanks, const double _eps=EPSILON)
Reduce all ranks up to a given accuracy and maximal number.
const Tensor & get_component(const size_t _idx) const
Read access to a specific component of the TT decomposition.
std::vector< size_t > dimensions
Dimensions of the external indices, i.e. the dimensions of the tensor represented by the network...