Skip to content

Commit 05b3749

Browse files
committed
unit test for solve_from_lu
1 parent c528e38 commit 05b3749

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/test_tools.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,23 @@ def test_add_geometry_to_collection(actx_factory):
278278

279279
# }}}
280280

281+
# {{{ test solve_from_lu
282+
283+
def test_solve_from_lu():
284+
import sumpy.symbolic as sym
285+
from pytential.utils import solve_from_lu
286+
x, y, z = sym.symbols("x, y, z")
287+
m = sym.Matrix([[0, x, y], [1, 0, x], [y, 2, 5]])
288+
L, U, perm = m.LUdecomposition()
289+
290+
b = sym.Matrix([z, 1, 2])
291+
sol = solve_from_lu(L, U, perm, b, lambda x: x.expand())
292+
expected = m.solve(b)
293+
294+
assert (sol - expected).expand() == sym.Matrix([0, 0, 0])
295+
296+
297+
# }}}
281298

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

0 commit comments

Comments
 (0)