From 8fc85da6507f8bb11658dc58348b7bb037d106e6 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Sun, 9 Sep 2018 22:06:53 -0500
Subject: [PATCH] Fix formatting

---
 benchmarks/bench_translations.py              | 10 +----
 .../translations/PDE-reduction-symbolic.ipynb |  2 +-
 sumpy/expansion/__init__.py                   |  2 +-
 sumpy/tools.py                                | 42 +++++++++----------
 4 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/benchmarks/bench_translations.py b/benchmarks/bench_translations.py
index 8d6cfdd8..621ac275 100644
--- a/benchmarks/bench_translations.py
+++ b/benchmarks/bench_translations.py
@@ -1,13 +1,10 @@
 import numpy as np
 
-import pytest
-import pyopencl as cl
 from pyopencl.tools import (  # noqa
         pytest_generate_tests_for_pyopencl as pytest_generate_tests)
 
 from sumpy.expansion.multipole import (
         VolumeTaylorMultipoleExpansion, H2DMultipoleExpansion,
-        VolumeTaylorMultipoleExpansionBase,
         LaplaceConformingVolumeTaylorMultipoleExpansion,
         HelmholtzConformingVolumeTaylorMultipoleExpansion)
 from sumpy.expansion.local import (
@@ -15,13 +12,11 @@ from sumpy.expansion.local import (
         LaplaceConformingVolumeTaylorLocalExpansion,
         HelmholtzConformingVolumeTaylorLocalExpansion)
 
-from sumpy.kernel import (LaplaceKernel, HelmholtzKernel, AxisTargetDerivative,
-        DirectionalSourceDerivative)
+from sumpy.kernel import LaplaceKernel, HelmholtzKernel
 
 import logging
 logger = logging.getLogger(__name__)
 
-import sympy
 import six
 import pymbolic.mapper.flop_counter
 
@@ -29,6 +24,7 @@ import sumpy.symbolic as sym
 from sumpy.assignment_collection import SymbolicAssignmentCollection
 from sumpy.codegen import to_loopy_insns
 
+
 class Param:
     def __init__(self, dim, order):
         self.dim = dim
@@ -125,5 +121,3 @@ class Helmholtz2DTranslation(TranslationBenchmarkSuite):
         Param(2, 15),
         Param(2, 20),
     ]
-
-
diff --git a/contrib/translations/PDE-reduction-symbolic.ipynb b/contrib/translations/PDE-reduction-symbolic.ipynb
index bffcdf9e..3550b079 100644
--- a/contrib/translations/PDE-reduction-symbolic.ipynb
+++ b/contrib/translations/PDE-reduction-symbolic.ipynb
@@ -125,7 +125,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.6.4"
+   "version": "3.6.5"
   }
  },
  "nbformat": 4,
diff --git a/sumpy/expansion/__init__.py b/sumpy/expansion/__init__.py
index 68a99197..a40aafde 100644
--- a/sumpy/expansion/__init__.py
+++ b/sumpy/expansion/__init__.py
@@ -400,7 +400,7 @@ class LinearRecurrenceBasedExpansionTermsWrangler(ExpansionTermsWrangler):
             n = nullspace(pde_mat)
             idx = self.get_reduced_coeffs()
             assert len(idx) >= n.shape[1]
-            s = solve_symbolic(n.T[:,idx], n.T)
+            s = solve_symbolic(n.T[:, idx], n.T)
             stored_identifiers = [mis[i] for i in idx]
         else:
             s = np.eye(len(mis))
diff --git a/sumpy/tools.py b/sumpy/tools.py
index 996f75f0..32d14bcb 100644
--- a/sumpy/tools.py
+++ b/sumpy/tools.py
@@ -657,50 +657,50 @@ def my_syntactic_subs(expr, subst_dict):
         return expr
 
 
-
 def rref(m):
-    l = np.array(m, dtype=object)
+    mat = np.array(m, dtype=object)
     index = 0
-    nrows = l.shape[0]
-    ncols = l.shape[1]
+    nrows = mat.shape[0]
+    ncols = mat.shape[1]
     pivot_cols = []
     for i in range(ncols):
         if index == nrows:
             break
         pivot = nrows
         for k in range(index, nrows):
-            if l[k, i] != 0 and pivot == nrows:
+            if mat[k, i] != 0 and pivot == nrows:
                 pivot = k
-            if abs(l[k, i]) == 1:
+            if abs(mat[k, i]) == 1:
                 pivot = k
                 break
         if pivot == nrows:
             continue
         if pivot != index:
-            l[pivot,:], l[index,:] = l[index,:].copy(), l[pivot,:].copy()
+            mat[[pivot, index], :] = mat[[index, pivot], :]
 
         pivot_cols.append(i)
-        scale = l[index, i]
-        t = l[index,:]//scale
-        not_exact = (t * scale != l[index, :])
+        scale = mat[index, i]
+        t = mat[index, :]//scale
+        not_exact = (t * scale != mat[index, :])
+
         if (np.any(not_exact)):
             for j in range(ncols):
                 if not_exact[j]:
-                    t[j] = sym.sympify(l[index, j])/scale
+                    t[j] = sym.sympify(mat[index, j])/scale
 
-        l[index,:] = t
+        mat[index, :] = t
 
         for j in range(nrows):
             if (j == index):
                 continue
 
-            scale = l[j, i]
+            scale = mat[j, i]
             if scale != 0:
-                l[j,:] = l[j,:] - l[index,:]*scale
+                mat[j, :] = mat[j, :] - mat[index, :]*scale
 
         index = index + 1
 
-    return l, pivot_cols
+    return mat, pivot_cols
 
 
 def nullspace(m):
@@ -716,17 +716,17 @@ def nullspace(m):
         vec[free_var] = 1
         for piv_row, piv_col in enumerate(pivot_cols):
             for pos in pivot_cols[piv_row+1:] + [free_var]:
-                vec[piv_col] -= mat[piv_row,pos]
+                vec[piv_col] -= mat[piv_row, pos]
         n.append(vec)
     return np.array(n, dtype=object).T
 
 
-def solve_symbolic(A, b):
-    if isinstance(A, sym.Matrix):
-        big = A.row_join(b)
+def solve_symbolic(a, b):
+    if isinstance(a, sym.Matrix):
+        big = a.row_join(b)
     else:
-        big = np.hstack((A, b))
+        big = np.hstack((a, b))
     red = rref(big)[0]
-    return red[:,big.shape[0]:]
+    return red[:, big.shape[0]:]
 
 # vim: fdm=marker
-- 
GitLab