Commit c145d622 authored by Philipp  Trunschke's avatar Philipp Trunschke
Browse files

bugfixes, improved efficiency, better IO

parent ebb92da9
Pipeline #2111 failed with stages
in 4 minutes and 12 seconds
......@@ -45,6 +45,7 @@ namespace xerus { namespace uq {
std::pair<size_t, size_t> validationSet;
double valueNorm_trainingSet;
double valueNorm_validationSet;
std::vector<std::vector<Tensor>> leftLHSStack; // contains successive contractions of x.T@A.T@A@x
std::vector<std::vector<Tensor>> leftRHSStack; // contains successive contractions of x.T@A.T@b
......@@ -88,6 +89,12 @@ namespace xerus { namespace uq {
/* // Reweighting parameters */
/* std::vector<double> weights; */
double initialResidual; //TODO: rename
size_t bestIteration;
TTTensor bestX;
double bestTrainingResidual;
double bestValidationResidual;
SALSA(const TTTensor& _x, const std::vector<Tensor>& _measures, const Tensor& _values);
void run();
......@@ -97,7 +104,8 @@ namespace xerus { namespace uq {
void calc_left_stack(const size_t _position);
void calc_right_stack(const size_t _position);
void adapt_rank(Tensor& _U, Tensor& _S, Tensor& _Vt, const size_t _maxRank, const double _threshold) const;
double residual(const std::pair<size_t, size_t> _slice) const;
double residual(const std::pair<size_t, size_t>& _slice) const;
double slow_residual(const std::pair<size_t, size_t>& _slice) const;
Tensor omega_operator() const;
Tensor alpha_operator() const;
void solve_local();
......
This diff is collapsed.
......@@ -154,5 +154,29 @@ void expose_recoveryAlgorithms(module& m) {
.value("Hermite", uq::PolynomBasis::Hermite)
.value("Legendre", uq::PolynomBasis::Legendre)
;
class_<uq::SALSA>(m, "uqSALSA")
.def(init<TTTensor, std::vector<Tensor>, Tensor>())
.def_readwrite("controlSetFraction", &uq::SALSA::controlSetFraction)
.def_readwrite("targetResidual", &uq::SALSA::targetResidual)
.def_readwrite("minDecrease", &uq::SALSA::minDecrease)
.def_readwrite("maxIterations", &uq::SALSA::maxIterations)
.def_readwrite("trackingPeriodLength", &uq::SALSA::trackingPeriodLength)
.def_readwrite("maxNonImprovingAlphaCycles", &uq::SALSA::maxNonImprovingAlphaCycles)
.def_readwrite("kmin", &uq::SALSA::kmin)
.def_readwrite("maxRanks;", &uq::SALSA::maxRanks)
.def_readwrite("maxIRsteps", &uq::SALSA::maxIRsteps)
.def_readwrite("IRtolerance", &uq::SALSA::IRtolerance)
.def_readwrite("sparsityThreshold", &uq::SALSA::sparsityThreshold)
.def_readwrite("fomega", &uq::SALSA::fomega)
.def_readwrite("omega_factor", &uq::SALSA::omega_factor)
.def_readwrite("falpha", &uq::SALSA::falpha)
.def_readwrite("alpha_factor", &uq::SALSA::alpha_factor)
.def_readwrite("basisWeights", &uq::SALSA::basisWeights)
.def("run", &uq::SALSA::run)
;
}
Supports Markdown
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