Skip to content
Snippets Groups Projects
Commit c085d887 authored by Max Kahnt's avatar Max Kahnt
Browse files

Fix truncation in new BlockGSSteps.

Squash fix.
parent b605bfa3
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -99,8 +99,7 @@ static constexpr double defaultCgTol = 1e-15; ...@@ -99,8 +99,7 @@ static constexpr double defaultCgTol = 1e-15;
template <class MBlock, class VBlock> template <class MBlock, class VBlock>
VBlock cg(const MBlock& m, VBlock r, size_t maxIter = defaultCgMaxIter, VBlock cg(const MBlock& m, VBlock r, size_t maxIter = defaultCgMaxIter,
double tol = defaultCgTol) { double tol = defaultCgTol) {
VBlock x; VBlock x(0);
x = 0;
VBlock p = r; VBlock p = r;
auto q = r; auto q = r;
auto rOldSquared = r * r; auto rOldSquared = r * r;
...@@ -140,11 +139,11 @@ namespace LocalSolverFromLinearSolver { ...@@ -140,11 +139,11 @@ namespace LocalSolverFromLinearSolver {
*/ */
template <class LinearSolver> template <class LinearSolver>
auto truncate(LinearSolver&& linearSolver) { auto truncate(LinearSolver&& linearSolver) {
return [&, localSolver = std::move(linearSolver) ]( return [linearSolver = std::move(linearSolver) ](
const auto& m, const auto& b, const auto& ignore) { const auto& m, const auto& b, const auto& ignore) {
using Return = typename std::result_of<LinearSolver(decltype(m), decltype(b))>::type; using Return = typename std::result_of<LinearSolver(decltype(m), decltype(b))>::type;
if (ignore.all()) if (ignore.all())
return Return{0}; return Return(0);
if (ignore.none()) if (ignore.none())
return linearSolver(m, b); return linearSolver(m, b);
......
...@@ -140,7 +140,7 @@ struct GSTestSuite { ...@@ -140,7 +140,7 @@ struct GSTestSuite {
type, reg ? "regularized" : ""); type, reg ? "regularized" : "");
test(&gsStep1, gsString1); test(&gsStep1, gsString1);
test(gsStep2Ptr.get(), gsString2); test(gsStep2Ptr.get(), gsString2);
diffTest(&gsStep1, gsString1, gsStep2Ptr.get(), gsString2, 1e-7); diffTest(&gsStep1, gsString1, gsStep2Ptr.get(), gsString2, 1e-9);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment