10   SECTION(
"Real valued") {
 
   12     auto const AtA = (A.transpose().matrix() * A.matrix()).eval();
 
   15     auto const actual = cg(AtA, (A.transpose().matrix() * expected.matrix()).eval());
 
   17     CHECK(actual.niters > 0);
 
   18     CHECK(std::abs(actual.residual) < 1e-6);
 
   19     CAPTURE(actual.residual);
 
   20     CAPTURE((A.matrix() * actual.result).transpose());
 
   21     CAPTURE(expected.transpose());
 
   22     CHECK((A.matrix() * actual.result).isApprox(expected.matrix(), 1e-6));
 
   25   SECTION(
"Complex valued") {
 
   27     auto const AhA = (A.conjugate().transpose().matrix() * A.matrix()).eval();
 
   30     auto const actual = cg(AhA, (A.conjugate().transpose().matrix() * expected.matrix()).eval());
 
   32     CHECK(actual.niters > 0);
 
   33     CHECK(std::abs(actual.residual) < 1e-6);
 
   34     CAPTURE(actual.residual);
 
   35     CAPTURE((A.matrix() * actual.result).transpose());
 
   36     CAPTURE(expected.transpose());
 
   37     CHECK((A.matrix() * actual.result).isApprox(expected.matrix(), 1e-6));
 
Solves $Ax = b$ for $x$, given $A$ and $b$.
 
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic > Image
A 2-dimensional list of elements of given type.
 
Eigen::Array< T, Eigen::Dynamic, 1 > Array
A 1-dimensional list of elements of given type.