From b39fd8217fbf98a921eaeb1f218632a09bda3f31 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 4 Jul 2016 17:47:47 +0200 Subject: Fix nesting of SolveWithGuess, and add unit test. --- test/sparse_solver.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'test/sparse_solver.h') diff --git a/test/sparse_solver.h b/test/sparse_solver.h index 8cf35bef7..fd6199f3e 100644 --- a/test/sparse_solver.h +++ b/test/sparse_solver.h @@ -13,12 +13,24 @@ template void solve_with_guess(IterativeSolverBase& solver, const MatrixBase& b, const Guess& g, Result &x) { - x = solver.derived().solveWithGuess(b.derived(),g); + if(internal::random()) + { + // With a temporary through evaluator + x = solver.derived().solveWithGuess(b,g) + Result::Zero(x.rows(), x.cols()); + } + else + { + // direct evaluation within x through Assignment + x = solver.derived().solveWithGuess(b.derived(),g); + } } template void solve_with_guess(SparseSolverBase& solver, const MatrixBase& b, const Guess& , Result& x) { - x = solver.derived().solve(b); + if(internal::random()) + x = solver.derived().solve(b) + Result::Zero(x.rows(), x.cols()); + else + x = solver.derived().solve(b); } template -- cgit v1.2.3