diff --git a/experiments/volume_potential_3d_derivatives.py b/experiments/volume_potential_3d_derivatives.py index 023871c27bc4e7b42975179e6110db48c897eed8..db78c3a98201fa6509e9f6e92802db78e27db31d 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, diff --git a/test/test_interpolation.py b/test/test_interpolation.py index 07fffa73b3088c41600b3295508a7d5e34c25159..bcc74a483bd74c38374567151752b5c48629ab85 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 6b24224c3fa917746b7a8d651a4287b92c604486..146c6e1f1d8d8ccb47ab6bba3a68b248956e60af 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() @@ -528,6 +527,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