MCPcopy Create free account
hub / github.com/dask/dask / test_solve

Function test_solve

dask/array/tests/test_linalg.py:714–742  ·  view source on GitHub ↗
(shape, chunk)

Source from the content-addressed store, hash-verified

712
713@pytest.mark.parametrize(("shape", "chunk"), [(20, 10), (50, 10)])
714def test_solve(shape, chunk):
715 rng = np.random.default_rng(1)
716
717 A = rng.integers(1, 10, (shape, shape))
718 dA = da.from_array(A, (chunk, chunk))
719
720 # vector
721 b = rng.integers(1, 10, shape)
722 db = da.from_array(b, chunk)
723
724 res = da.linalg.solve(dA, db)
725 assert_eq(res, scipy.linalg.solve(A, b), check_graph=False)
726 assert_eq(dA.dot(res), b.astype(float), check_graph=False)
727
728 # tall-and-skinny matrix
729 b = rng.integers(1, 10, (shape, 5))
730 db = da.from_array(b, (chunk, 5))
731
732 res = da.linalg.solve(dA, db)
733 assert_eq(res, scipy.linalg.solve(A, b), check_graph=False)
734 assert_eq(dA.dot(res), b.astype(float), check_graph=False)
735
736 # matrix
737 b = rng.integers(1, 10, (shape, shape))
738 db = da.from_array(b, (chunk, chunk))
739
740 res = da.linalg.solve(dA, db)
741 assert_eq(res, scipy.linalg.solve(A, b), check_graph=False)
742 assert_eq(dA.dot(res), b.astype(float), check_graph=False)
743
744
745@pytest.mark.parametrize(("shape", "chunk"), [(20, 10), (50, 10)])

Callers

nothing calls this directly

Calls 4

assert_eqFunction · 0.90
integersMethod · 0.45
dotMethod · 0.45
astypeMethod · 0.45

Tested by

no test coverage detected