Skip to main content

taichi.linalg.sparse_cg#

class taichi.linalg.sparse_cg.SparseCG(A, b, x0=None, max_iter=50, atol=1e-06)#

Conjugate-gradient solver built for SparseMatrix.

Use conjugate-gradient method to solve the linear system Ax = b, where A is SparseMatrix.

Parameters:
  • A (SparseMatrix) – The coefficient matrix A of the linear system.

  • b (numpy ndarray, taichi Ndarray) – The right-hand side of the linear system.

  • x0 (numpy ndarray, taichi Ndarray) – The initial guess for the solution.

  • max_iter (int) – Maximum number of iterations.

  • atol – Tolerance(absolute) for convergence.

solve(self)#