Commit 6743ae1b authored by Sebastian Wolf's avatar Sebastian Wolf

Merge branch 'development' of git:xerus/xerus into development

parents 02e4a782 521dd164
Pipeline #939 passed with stages
in 9 minutes and 57 seconds
......@@ -72,7 +72,7 @@ COMPILE_THREADS = 8 # Number of threads to use during link time optimizatio
# You can add all kind of debuging options. In the following are some examples
DEBUG += -g # Adds debug symbols
DEBUG += -g # Adds debug symbols
# DEBUG += -D _GLIBCXX_ASSERTIONS # Activate GLIBCXX assertions
# Sanitization
......@@ -119,6 +119,7 @@ LOGGING += -D XERUS_LOG_INFO # Information that is not linke
# and bfd, all of which are available through common GNU/Linux packaging systems. If you want to
# build a shared library or run the unit tests of Xerus you have to provide the corresponding
# libraries here (otherwise only when linking your own program using Xerus).
# Make sure to use a parallel version of blas when compiling with -fopenmp.
# Uncomment or add the appropriate blas libraries
BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
......
......@@ -36,4 +36,6 @@ namespace xerus { namespace uq {
void uq_ra_adf(TTTensor& _x, const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const double _targetEps = 1e-8, const size_t _maxItr = 0, const double _initalRankEps = 1e-2);
TTTensor uq_ra_adf(const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const std::vector<size_t>& _dimensions, const double _targetEps = 1e-8, const size_t _maxItr = 0);
TTTensor uq_ra_adf_iv(TTTensor& _x, const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const double _targetEps = 1e-8, const size_t _maxItr = 0);
}}
......@@ -36,7 +36,6 @@
#endif
namespace xerus { namespace uq { namespace impl_uqRaAdf {
const size_t tracking = 10;
template<size_t P>
......@@ -45,7 +44,7 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf {
const size_t d;
const double targetResidual;
const size_t maxRank = 75;
const size_t maxRank = 50;
const double minRankEps = 1e-8;
const double epsDecay = 0.8;
......@@ -519,5 +518,22 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf {
return x;
}
TTTensor uq_ra_adf_iv(TTTensor& _x, const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const double _targetEps, const size_t _maxItr) {
REQUIRE(_measurments.parameterVectors.size() == _measurments.solutions.size(), "Invalid measurments");
REQUIRE(_x.dimensions.front() == _measurments.solutions.front().size, "Inconsitent spacial dimension");
for(size_t i=0; i < _measurments.parameterVectors.size(); ++i) {
REQUIRE(_x.degree() <= _measurments.parameterVectors[i].size(), "Parameter vector for sample " << i << " to short: " << _measurments.parameterVectors[i]);
for(size_t j=0; j < _measurments.parameterVectors[i].size(); ++j) {
if(_measurments.parameterVectors[i][j] > 1 || _measurments.parameterVectors[i][j] < -1) {
std::cout << "i=" << i << ", sample=" << _measurments.parameterVectors[i] << std::endl;
REQUIRE(false, "Sample parameter is not -1 <= x <= 1");
}
}
}
impl_uqRaAdf::InternalSolver<2> solver(_x, _measurments, _basisType, _maxItr, _targetEps, 1e-1);
solver.solve();
return _x;
}
}} // namespace uq | xerus
......@@ -174,6 +174,11 @@ void expose_recoveryAlgorithms() {
}, (arg("measurements"), arg("polynombasis"), arg("dimensions"), arg("targeteps"), arg("maxitr"))
);
def("uq_ra_adf_iv", +[](TTTensor& _x, const uq::UQMeasurementSet& _measurements, const uq::PolynomBasis _basisType, const double _targetEps, const size_t _maxItr){
return uq::uq_ra_adf_iv(_x, _measurements, _basisType, _targetEps, _maxItr);
}, (arg("initial guess"), arg("measurements"), arg("polynombasis"), arg("targeteps"), arg("maxitr"))
);
def("uq_tt_evaluate", +[](const TTTensor& _x, const std::vector<double>& _parameters, const uq::PolynomBasis _basisType) {
return uq::evaluate(_x, _parameters, _basisType);
}, (arg("x"), arg("parameters"), arg("basisType"))
......
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