From b52628ac297e3cae733fc807fd2cab8d7f92d3a4 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Tue, 7 Jul 2020 15:23:48 -0500
Subject: [PATCH] More docs

---
 sumpy/expansion/__init__.py | 14 +++++++++++---
 sumpy/expansion/pde.py      |  6 ++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/sumpy/expansion/__init__.py b/sumpy/expansion/__init__.py
index f8a3ada1..1b3268b5 100644
--- a/sumpy/expansion/__init__.py
+++ b/sumpy/expansion/__init__.py
@@ -332,9 +332,9 @@ class LinearPDEBasedExpansionTermsWrangler(ExpansionTermsWrangler):
 
     def get_pde(self):
         r"""
-        Returns a PDE. A PDE stores a dictionary of (mi, coeff)
-        where mi is the multi-index of the  derivative and coeff is the
-        coefficient
+        Returns a :class:`sumpy.expansion.pde.PDE` object.
+        A PDE stores a dictionary of (mi, coeff) where mi is the multi-index
+        of the  derivative and coeff is the coefficient.
         """
 
         raise NotImplementedError
@@ -359,6 +359,8 @@ class LinearPDEBasedExpansionTermsWrangler(ExpansionTermsWrangler):
                 projection_matrix_assignments = [list() for i in range(len(mis))]
                 return mis, CSEMatVec(projection_matrix_assignments)
 
+        # Calculate the multi-index that appears last in in the PDE in
+        # reverse degree lexicographic order.
         max_mi_idx = max(coeff_ident_enumerate_dict[ident] for
                          ident in pde_dict.keys())
         max_mi = mis[max_mi_idx]
@@ -376,12 +378,18 @@ class LinearPDEBasedExpansionTermsWrangler(ExpansionTermsWrangler):
         projection_matrix_assignments = []
         for i, mi in enumerate(mis):
             projection_matrix_assignments.append([])
+            # If the multi-index is to be stored, keep the projection matrix
+            # entry empty
             if is_stored(mi):
                 continue
             diff = [mi[d] - max_mi[d] for d in range(self.dim)]
+
+            # eg: u_xx + u_yy + u_zz is represented as
+            # [((2, 0, 0), 1), ((0, 2, 0), 1), ((0, 0, 2), 1)]
             for other_mi, coeff in iteritems(pde_dict):
                 j = coeff_ident_enumerate_dict[add_mi(other_mi, diff)]
                 if i == j:
+                    # Skip the u_zz part here.
                     continue
                 # PDE might not have max_mi_coeff = -1, divide by -max_mi_coeff
                 # to get a relation of the form, u_zz = - u_xx - u_yy for Laplace 3D.
diff --git a/sumpy/expansion/pde.py b/sumpy/expansion/pde.py
index 34f95cb2..b61d3a63 100644
--- a/sumpy/expansion/pde.py
+++ b/sumpy/expansion/pde.py
@@ -24,6 +24,12 @@ THE SOFTWARE.
 
 from sumpy.tools import add_mi
 
+__doc__ = """
+PDE interface
+-------------
+
+.. autoclass:: PDE
+"""
 
 class PDE(object):
     r"""
-- 
GitLab