Commit 04a15b8f authored by Fuchsi*'s avatar Fuchsi*

fixed return value of calculate_svd (closes #220) and updated its documentation

parent c66920f5
Pipeline #1088 failed with stages
in 5 minutes and 4 seconds
......@@ -4,6 +4,7 @@ Potentially breaking changes are marked with an exclamation point '!' at the beg
* 2019-03-?? v4.0.0
* Added the HTTensor class for Hierarchical Tensor Decompositions with balanced trees.
* ! Changed the truncated SVD, TensorNetwork::round_edge and TT:round with epsilon to limit their respective relative errors to epsilon.
* ! Removed support for the replacement allocator.
* ! Changed some Makefile configs for more flexibility. See the new file and update your own config.
......@@ -945,7 +945,8 @@ namespace xerus {
* @param _input input Tensor of which the SVD shall be calculated.
* @param _splitPos index position at defining the matrification for which the SVD is calculated.
* @param _maxRank maximal Rank to be kept by SVD
* @param _eps all singular values smaller than _eps are cut off
* @param _eps small singular values are removed as long as the introduced error is < @a _eps (_after_ @a _maxRank was applied)
* @return the frobenious norm of the error introduced by the rank reduction
value_t calculate_svd(Tensor& _U, Tensor& _S, Tensor& _Vt, Tensor _input, const size_t _splitPos, const size_t _maxRank, const value_t _eps);
......@@ -1491,8 +1491,11 @@ namespace xerus {
_U.resize_mode(, rank);
_Vt.resize_mode(0, rank);
if (rank < full_rank) { return std::abs(_input.factor)*tmpS[rank]; }
else { return 0; }
if (rank < full_rank) {
return blasWrapper::two_norm(tmpS.get()+rank, full_rank-rank);
} else {
return 0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment