Commit ce8c4233 authored by Ben Huber's avatar Ben Huber

use eps/sqrt(d-1) in TTNetwork constructor to be consistent with TTN::round(eps) (relates #215)

parent adf5784b
Pipeline #1136 passed with stages
in 23 minutes and 20 seconds
......@@ -76,11 +76,11 @@ namespace xerus {
/**
* @def XERUS_deprecated
* @brief Attribute to mark deprecated functions if supported by currently used c++ standard.
* @brief Attribute to mark deprecated functions if supported by currently used c++ version.
*/
#if __cplusplus > 201400L
#define XERUS_deprecated(msg) [[deprecated(msg)]]
#elif defined(GCC_VERSION) && GCC_VERSION > 40900
#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__) > 409
#define XERUS_deprecated(msg) [[gnu::deprecated(msg)]]
#else
#define XERUS_deprecated(msg)
......
......@@ -146,14 +146,17 @@ namespace xerus {
remains.reinterpret_dimensions(extDimensions);
Tensor singularValues, newNode;
for(size_t position = numComponents-1; position > 0; --position) {
calculate_svd(remains, singularValues, newNode, remains, 1+position*N, _maxRanks[position-1], _eps);
set_component(position, std::move(newNode));
newNode.reset();
xerus::contract(remains, remains, false, singularValues, false, 1);
}
if (numComponents > 1) {
Tensor singularValues, newNode;
auto epsPerSite = misc::hard_equal(_eps, 0.0) ? EPSILON : _eps / std::sqrt(double(numComponents-1));
for(size_t position = numComponents-1; position > 0; --position) {
calculate_svd(remains, singularValues, newNode, remains, 1+position*N, _maxRanks[position-1], epsPerSite);
set_component(position, std::move(newNode));
newNode.reset();
xerus::contract(remains, remains, false, singularValues, false, 1);
}
}
set_component(0, remains);
assume_core_position(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