diff --git a/sumpy/expansion/__init__.py b/sumpy/expansion/__init__.py index c865b476a6ef515c984b7b725b1eae2015cca52b..c060b8da9b47f2456580acad30aab5faa5fe7004 100644 --- a/sumpy/expansion/__init__.py +++ b/sumpy/expansion/__init__.py @@ -405,12 +405,16 @@ class NewLinearRecurrenceBasedDerivativeWrangler \ eq[coeff_ident_enumerate_dict[c]] = 1 pde_mat.append(eq) - pde_mat = np.array(pde_mat, dtype=np.float64) - n = nullspace(pde_mat, atol=tol) - k, idx, _ = interp_decomp(n.T, tol) - idx = idx[:k] - s = np.linalg.solve(n[idx, :].T, n.T).T - stored_identifiers = [mis[i] for i in idx] + if len(pde_mat) > 0: + pde_mat = np.array(pde_mat, dtype=np.float64) + n = nullspace(pde_mat, atol=tol) + k, idx, _ = interp_decomp(n.T, tol) + idx = idx[:k] + s = np.linalg.solve(n[idx, :].T, n.T).T + stored_identifiers = [mis[i] for i in idx] + else: + s = np.eye(len(mis)) + stored_identifiers = mis coeff_matrix = defaultdict(lambda: []) for i in range(s.shape[0]):