From 00c24400bae07145f60f430a6836345b07f2edb0 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Wed, 25 Jan 2017 18:01:30 -0600 Subject: [PATCH] CSE: get_subset_candidates() shouldn't default to an empty whitelist. --- sumpy/cse.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sumpy/cse.py b/sumpy/cse.py index b689786d..350a2c8d 100644 --- a/sumpy/cse.py +++ b/sumpy/cse.py @@ -192,16 +192,19 @@ class FuncArgTracker(object): (k, v) for k, v in count_map.items() if v >= threshold) - def get_subset_candidates(self, argset, restrict_to_funcset=frozenset()): + def get_subset_candidates(self, argset, restrict_to_funcset=None): """ Return a set of functions each of which whose argument list contains - `argset.` + `argset`, optionally filtered only to contain functions in + `restrict_to_funcset`. """ iarg = iter(argset) indices = set( - fi for fi in self.arg_to_funcset[next(iarg)] - if fi in restrict_to_funcset) + fi for fi in self.arg_to_funcset[next(iarg)]) + + if restrict_to_funcset is not None: + indices &= restrict_to_funcset for arg in iarg: indices &= self.arg_to_funcset[arg] -- GitLab