diff --git a/sumpy/expansion/__init__.py b/sumpy/expansion/__init__.py index 1b3268b5dffee0bea5bd41e0a6a24bd6afe5b999..aa09ddf5f59473d7eecb1230b20c9bc0b2504f2d 100644 --- a/sumpy/expansion/__init__.py +++ b/sumpy/expansion/__init__.py @@ -236,15 +236,15 @@ class CSEMatVec(object): .. attribute:: assignments - A list of tuples where the first argument of the tuple - is a row and the second argument is a list. If the - second argument is empty, the row is equal to the first - unused element from the vector. If not, the second - argument gives a list of tuples indicating a linear - combination of previously calculated row. - - The matrix represented is a square matrix with the number - of rows equal to the length of the `assignments` list. + A list of lists indicating a linear combination of previously + calculated rows. If an element of the `assignments` is empty, + then that row is taken from the first unused row from the + vector. Each element is a list of tuples where first argument + is a previous row number and the second argument is the weight + in the linear combination. + + Number of rows in the matrix represented is equal to the + length of the `assignments` list. """ def __init__(self, assignments): diff --git a/sumpy/expansion/pde.py b/sumpy/expansion/pde.py index b61d3a6376a059bb6cc41db203e3602821bd53ee..5aa93e4d3cf034d65910f9e6bfc9660185fb485e 100644 --- a/sumpy/expansion/pde.py +++ b/sumpy/expansion/pde.py @@ -31,6 +31,7 @@ PDE interface .. autoclass:: PDE """ + class PDE(object): r""" Represents a scalar, constant-coefficient PDE of dimension `dim`. diff --git a/test/test_misc.py b/test/test_misc.py index d8aff52f0e7918b65ef5572eae577e4a77983a5c..8823d183e4fb985f0c34b3b1339d680afea1eef2 100644 --- a/test/test_misc.py +++ b/test/test_misc.py @@ -278,6 +278,23 @@ def test_toy_p2e2e2p(ctx_factory, case): (conv_factor, case.conv_factor * (1 + RTOL_P2E2E2P)) +def test_cse_matvec(): + from sumpy.expansion import CSEMatVec + assignments = [[], [(0, 3)], [], [(2, 7), (1, 5)]] + op = CSEMatVec(assignments) + m = np.array([[1, 0], [3, 0], [0, 1], [15, 7]]) + + vec = np.random.random(2) + expected_result = m @ vec + actual_result = op.matvec(vec, sac=None) + assert np.allclose(expected_result, actual_result) + + vec = np.random.random(4) + expected_result = m.T @ vec + actual_result = op.transpose_matvec(vec, sac=None) + assert np.allclose(expected_result, actual_result) + + # You can test individual routines by typing # $ python test_misc.py 'test_p2p(cl.create_some_context)'