Skip to content

Commit

Permalink
unit test for solve_from_lu
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf committed Dec 20, 2022
1 parent c528e38 commit 05b3749
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,23 @@ def test_add_geometry_to_collection(actx_factory):

# }}}

# {{{ test solve_from_lu

def test_solve_from_lu():
import sumpy.symbolic as sym
from pytential.utils import solve_from_lu
x, y, z = sym.symbols("x, y, z")
m = sym.Matrix([[0, x, y], [1, 0, x], [y, 2, 5]])
L, U, perm = m.LUdecomposition()

b = sym.Matrix([z, 1, 2])
sol = solve_from_lu(L, U, perm, b, lambda x: x.expand())
expected = m.solve(b)

assert (sol - expected).expand() == sym.Matrix([0, 0, 0])


# }}}

# You can test individual routines by typing
# $ python test_tools.py 'test_routine()'
Expand Down

0 comments on commit 05b3749

Please sign in to comment.