diff --git a/python/taichi/linalg/matrixfree_cg.py b/python/taichi/linalg/matrixfree_cg.py index 6af5ef177c387..0d333f4bbcea0 100644 --- a/python/taichi/linalg/matrixfree_cg.py +++ b/python/taichi/linalg/matrixfree_cg.py @@ -18,7 +18,7 @@ def matvec(self, x, Ax): def MatrixFreeCG(A, b, x, tol=1e-6, maxiter=5000, quiet=True): """Matrix-free conjugate-gradient solver. - + Use conjugate-gradient method to solve the linear system Ax = b, where A is implicitly represented as a LinearOperator. @@ -30,7 +30,7 @@ def MatrixFreeCG(A, b, x, tol=1e-6, maxiter=5000, quiet=True): atol: Tolerance(absolute) for convergence. quiet (bool): Switch to turn on/off iteration log. """ - + if b.dtype != x.dtype: raise TaichiTypeError(f"Dtype mismatch b.dtype({b.dtype}) != x.dtype({x.dtype}).") if str(b.dtype) == "f32": diff --git a/python/taichi/linalg/sparse_cg.py b/python/taichi/linalg/sparse_cg.py index 5ebdf663f5ca9..e0aba8112c690 100644 --- a/python/taichi/linalg/sparse_cg.py +++ b/python/taichi/linalg/sparse_cg.py @@ -8,7 +8,7 @@ class SparseCG: """Conjugate-gradient solver built for SparseMatrix. - + Use conjugate-gradient method to solve the linear system Ax = b, where A is SparseMatrix. Args: @@ -18,7 +18,7 @@ class SparseCG: max_iter (int): Maximum number of iterations. atol: Tolerance(absolute) for convergence. """ - + def __init__(self, A, b, x0=None, max_iter=50, atol=1e-6): self.dtype = A.dtype self.ti_arch = get_runtime().prog.config().arch