From d3d4833a68132ca6b454b7734f7ad42a6292408b Mon Sep 17 00:00:00 2001 From: xywei Date: Mon, 13 Jul 2020 16:26:20 -0500 Subject: [PATCH 1/3] Fixes for api changes --- experiments/volume_potential_3d_derivatives.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/experiments/volume_potential_3d_derivatives.py b/experiments/volume_potential_3d_derivatives.py index 023871c..db78c3a 100644 --- a/experiments/volume_potential_3d_derivatives.py +++ b/experiments/volume_potential_3d_derivatives.py @@ -323,9 +323,11 @@ local_expn_class = expn_factory.get_local_expansion_class(knl) mpole_expn_class = expn_factory.get_multipole_expansion_class(knl) exclude_self = True -from volumential.expansion_wrangler_interface import ExpansionWranglerCodeContainer +from volumential.expansion_wrangler_fpnd import ( + FPNDExpansionWranglerCodeContainer, + FPNDExpansionWrangler) -wcc = ExpansionWranglerCodeContainer( +wcc = FPNDExpansionWranglerCodeContainer( ctx, partial(mpole_expn_class, knl), partial(local_expn_class, knl), @@ -339,8 +341,6 @@ if exclude_self: else: self_extra_kwargs = {} -from volumential.expansion_wrangler_fpnd import FPNDExpansionWrangler - wrangler = FPNDExpansionWrangler( code_container=wcc, queue=queue, -- GitLab From c1c27ad45f6b459b8b9f869a89cab388532ef130 Mon Sep 17 00:00:00 2001 From: xywei Date: Tue, 14 Jul 2020 14:00:57 -0500 Subject: [PATCH 2/3] Fix random polynomial generation in test suits --- test/test_interpolation.py | 4 +++- volumential/tools.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/test_interpolation.py b/test/test_interpolation.py index 07fffa7..bcc74a4 100644 --- a/test/test_interpolation.py +++ b/test/test_interpolation.py @@ -50,8 +50,10 @@ def random_polynomial_func(dim, degree, seed=None): npts = pts.shape[1] res = np.zeros(npts) for deg in np.ndindex(coefs.shape): + mono = np.ones(npts) for iaxis in range(dim): - res += coefs[deg] * pts[iaxis, :]**deg[iaxis] + mono += pts[iaxis, :]**deg[iaxis] + res += coefs[deg] * mono return res return poly_func diff --git a/volumential/tools.py b/volumential/tools.py index 6b24224..b189e26 100644 --- a/volumential/tools.py +++ b/volumential/tools.py @@ -528,6 +528,18 @@ class DiscreteLegendreTransform(BoxSpecificMap): # }}} End discrete Legendre transform +# {{{ inverse discrete Legendre transform + + +class InverseDiscreteLegendreTransform(BoxSpecificMap): + """ + Box-specific transform that maps box-local modal coefficients + to nodal values. Inverse of :class:`DiscreteLegendreTransform`. + """ + pass + +# }}} End inverse discrete Legendre transform + # }}} End box-specific maps # {{{ box-specific reductions -- GitLab From 42159294434cff02b7b9bad5880213c811f7d933 Mon Sep 17 00:00:00 2001 From: xywei Date: Tue, 14 Jul 2020 15:45:15 -0500 Subject: [PATCH 3/3] Formatting --- volumential/tools.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/volumential/tools.py b/volumential/tools.py index b189e26..146c6e1 100644 --- a/volumential/tools.py +++ b/volumential/tools.py @@ -496,14 +496,13 @@ class DiscreteLegendreTransform(BoxSpecificMap): """ if filtering is None: - filter_multiplier = 1 + cl.array.zeros(queue, - self.degree**self.dim, np.float64) + filter_multiplier = 1 + cl.array.zeros( + queue, self.degree**self.dim, np.float64) elif isinstance(filtering, cl.array.Array): assert filtering.shape == (self.degree**self.dim,) filter_multiplier = filtering else: - raise RuntimeError("Invalid filtering argument: %s" - % str(filtering)) + raise RuntimeError(f"Invalid filtering argument: {str(filtering)}") knl = self.get_cached_optimized_kernel() -- GitLab