blob: 06147bb81e7eaacb4a5601a65a735e1c20388310 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
int n = 10000;
VectorXd x(n), b(n);
SparseMatrix<double> A(n,n);
/* ... fill A and b ... */
BiCGSTAB<SparseMatrix<double> > solver(A);
// start from a random solution
x = VectorXd::Random(n);
solver.setMaxIterations(1);
int i = 0;
do {
x = solver.solveWithGuess(b,x);
std::cout << i << " : " << solver.error() << std::endl;
++i;
} while (solver.info()!=Success && i<100);
|