diff --git a/python/taichi/linalg/__init__.py b/python/taichi/linalg/__init__.py index 3c49063c11a2a..c4e28878b1b59 100644 --- a/python/taichi/linalg/__init__.py +++ b/python/taichi/linalg/__init__.py @@ -1,6 +1,6 @@ """Taichi support module for sparse matrix operations. """ -from taichi.linalg.cg import CG +from taichi.linalg.sparse_cg import SparseCG from taichi.linalg.sparse_matrix import * from taichi.linalg.sparse_solver import SparseSolver from taichi.linalg.matrixfree_cg import * diff --git a/python/taichi/linalg/cg.py b/python/taichi/linalg/sparse_cg.py similarity index 99% rename from python/taichi/linalg/cg.py rename to python/taichi/linalg/sparse_cg.py index 21973641e4db3..fc0611fbff660 100644 --- a/python/taichi/linalg/cg.py +++ b/python/taichi/linalg/sparse_cg.py @@ -6,7 +6,7 @@ from taichi.types import f32, f64 -class CG: +class SparseCG: 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 diff --git a/tests/python/test_cg.py b/tests/python/test_sparse_cg.py similarity index 93% rename from tests/python/test_cg.py rename to tests/python/test_sparse_cg.py index bd0eb38445f20..ad6afa4c071f4 100644 --- a/tests/python/test_cg.py +++ b/tests/python/test_sparse_cg.py @@ -28,7 +28,7 @@ def fill( fill(Abuilder, A_psd, b) A = Abuilder.build(dtype=ti_dtype) - cg = ti.linalg.CG(A, b, x0, max_iter=50, atol=1e-6) + cg = ti.linalg.SparseCG(A, b, x0, max_iter=50, atol=1e-6) x, exit_code = cg.solve() res = np.linalg.solve(A_psd, b.to_numpy()) assert exit_code == True @@ -59,7 +59,7 @@ def fill( fill(Abuilder, A_psd, b) A = Abuilder.build(dtype=ti_dtype) - cg = ti.linalg.CG(A, b, x0, max_iter=50, atol=1e-6) + cg = ti.linalg.SparseCG(A, b, x0, max_iter=50, atol=1e-6) x, exit_code = cg.solve() res = np.linalg.solve(A_psd, b.to_numpy()) assert exit_code == True