Skip to content

Commit

Permalink
Rename cg into sparse_cg.
Browse files Browse the repository at this point in the history
  • Loading branch information
houkensjtu committed Apr 27, 2023
1 parent ead0549 commit 3371aae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/taichi/linalg/__init__.py
Original file line number Diff line number Diff line change
@@ -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 *
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/python/test_cg.py → tests/python/test_sparse_cg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3371aae

Please sign in to comment.