libeigen/eigen!2509 Closes #2868 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
15 lines
450 B
C++
15 lines
450 B
C++
// SPDX-FileCopyrightText: The Eigen Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
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
|