solveCG
fun SparseMatrix.solveCG(b: DoubleArray, tolerance: Double = 1.0E-10, maxIterations: Int = max(50, rows * 2)): DoubleArray(source)
Solves the symmetric positive-definite system this * x = b using the Jacobi-preconditioned conjugate gradient method.
This matrix is never formed densely, only matrix-vector products are used, which makes this suitable for the large sparse systems produced by discretized Laplacians.
Return
The solution vector x.
Parameters
b
The right-hand side vector, of size SparseMatrix.rows.
tolerance
Target relative residual norm at which iteration stops.
maxIterations
Maximum number of conjugate gradient iterations.