I am trying to numerically solve a linear system of equations of the form
A x = a
where A
is really ill-conditioned and a
a vector. Both A
and a
are known and I need to determine x
.
Such systems of linear equations arise when considering discretisations of PDEs using spectral collocation methods, for instance. In order to solve this problem, I am trying to use arbitrary precision and iterative methods that use preconditioners.
One such preconditioner, is to find a finite difference approximation to A
and a
, which I will denote by B
and b
respectively. I would like to know how to take advantage of this using Mathematica.
So far, my code looks like the following:
g = LinearSolve[B];
f = x \[Function] g[x];
solF = f[b];
LinearSolve[A, a,
Method -> {"Krylov", "Method" -> "BiCGSTAB",
"Preconditioner" -> f, "StartingVector" -> solF}]
Is there a more efficient way of doing this?
A
given? IsA
a dense matrix, a sparse array` or only a function that implements matrix-vector multiplication? $\endgroup$A
is really dense, butB
is rather sparse. $\endgroup$A
on vectors without assembling it? $\endgroup$A
on vectors... $\endgroup$