Skip to content

Commit

Permalink
Show both reported and real error in solve_mm
Browse files Browse the repository at this point in the history
  • Loading branch information
ddemidov committed Dec 24, 2014
1 parent 76d8fa8 commit 519bcd5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions examples/solve_mm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,16 @@ int main(int argc, char *argv[]) {
boost::tie(iters, resid) = solve(f, x);
prof.toc("solve");

// Check the real error
double error = (rhs - A * Eigen::Map<EigenVector>(x.data(), x.size())).norm() / rhs.norm();

prof.tic("write");
Eigen::saveMarketVector(Eigen::Map<EigenVector>(x.data(), x.size()), out_file);
prof.toc("write");

std::cout << "Iterations: " << iters << std::endl
<< "Error: " << resid << std::endl
<< std::endl << prof << std::endl;

std::cout << "Iterations: " << iters << std::endl
<< "Reported Error: " << resid << std::endl
<< "Real error: " << error << std::endl
<< prof << std::endl
;
}

0 comments on commit 519bcd5

Please sign in to comment.