aboutsummaryrefslogtreecommitdiff
path: root/doc/snippets/BiCGSTAB_simple.cpp
blob: 5520f4f1f058ed13dc6b13413e1c66103134e67b (plain)
1
2
3
4
5
6
7
8
9
10
11
  int n = 10000;
  VectorXd x(n), b(n);
  SparseMatrix<double> A(n,n);
  /* ... fill A and b ... */ 
  BiCGSTAB<SparseMatrix<double> > solver;
  solver.compute(A);
  x = solver.solve(b);
  std::cout << "#iterations:     " << solver.iterations() << std::endl;
  std::cout << "estimated error: " << solver.error()      << std::endl;
  /* ... update b ... */
  x = solver.solve(b); // solve again