Commit 5d4eb714 authored by Sebastian Wolf's avatar Sebastian Wolf

Added require to reject ALS(A, x, x) calls

parent 64537d50
Pipeline #1144 passed with stages
in 20 minutes and 55 seconds
......@@ -482,21 +482,23 @@ namespace xerus {
double ALSVariant::solve(const TTOperator *_Ap, TTTensor &_x, const TTTensor &_b, size_t _numHalfSweeps, value_t _convergenceEpsilon, PerformanceData &_perfData) const {
LOG(ALS, "ALS("<< sites <<") called");
REQUIRE(&_x != &_b, "Cannot use the same TTTensor as _x and _b. Make a copy of _x and use it as _b?");
REQUIRE(_x.order() > 0, "The ALS implementation requires x to have order larger then 0.");
REQUIRE(_x.dimensions == _b.dimensions, "The ALS implementation requires x and b to have the same dimensions."); //TODO why?
REQUIRE(_x.order() > 0, "");
REQUIRE(_x.dimensions == _b.dimensions, "");
if (_Ap != nullptr) {
REQUIRE(_Ap->dimensions.size() == _b.dimensions.size()*2, "");
REQUIRE(_Ap->dimensions.size() == _b.dimensions.size()*2, "Inconsistend order of A and x/b");
for (size_t i=0; i<_x.dimensions.size(); ++i) {
REQUIRE(_Ap->dimensions[i] == _x.dimensions[i], "");
REQUIRE(_Ap->dimensions[i+_Ap->order()/2] == _x.dimensions[i], "");
REQUIRE(_Ap->dimensions[i] == _x.dimensions[i], "Inconsistend local dimensions between of A and x/b");
REQUIRE(_Ap->dimensions[i+_Ap->order()/2] == _x.dimensions[i], "Inconsistend local dimensions between of A and x/b");
if (_Ap != nullptr) {
_perfData << "ALS for ||A*x - b||^2, x.dimensions: " << _x.dimensions << '\n'
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