From ec0c11b2a813a133721e10cc4361617ff8535e16 Mon Sep 17 00:00:00 2001 From: Isuru Fernando <isuruf@gmail.com> Date: Tue, 7 Jul 2020 14:53:11 -0500 Subject: [PATCH] Document some function arguments and return types --- sumpy/expansion/__init__.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sumpy/expansion/__init__.py b/sumpy/expansion/__init__.py index 07e2a745..f8a3ada1 100644 --- a/sumpy/expansion/__init__.py +++ b/sumpy/expansion/__init__.py @@ -251,6 +251,15 @@ class CSEMatVec(object): self.assignments = assignments def matvec(self, vec, sac): + """ + :arg vec: vector for the matrix vector multiplication + + :arg sac: an object of type + :class:`sumpy.assignment_collection.SymbolicAssignmentCollection` + for storing intermediate row values. If given `None`, the + matvec operation will not use common subexpression elimination + resulting in an expensive matvec + """ res = [0] * len(self.assignments) stored_idx = 0 for row, deps in enumerate(self.assignments): @@ -279,7 +288,7 @@ class CSEMatVec(object): expr_all[k] += new_sym * v else: for k, v in deps: - expr_all[k] += sym.sympify(expr_all[row] * v).expand(deep=False) + expr_all[k] += expr_all[row] * v res.reverse() return res @@ -389,8 +398,9 @@ class LinearPDEBasedExpansionTermsWrangler(ExpansionTermsWrangler): @memoize_method def get_projection_matrix(self, rscale): """ - Return a matrix that expresses every derivative in terms of a - set of "stored" derivatives. + Return a :class:`CSEMatVec` class which exposes a matrix vector + multiplication operator for the projection matrix that expresses + every derivative in terms of a set of "stored" derivatives. For example, for the PDE:: -- GitLab