Commit 8a8e5e3c authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

OPT: more minor speedup

parent 3be1558e
Pipeline #5289 failed with stage
in 8 minutes and 45 seconds
......@@ -179,7 +179,7 @@ class RadialBasis(BasisFunc):
upper = (self.centroids + self.size[:, None] + extent).max(0)
return tuple(zip(lower, upper))
def precompute_evaluator(self, extent=0, resolution=4):
def precompute_evaluator(self, extent=0, resolution=None):
"""
Precomputes which dipoles intersect with a grid
......@@ -188,6 +188,8 @@ class RadialBasis(BasisFunc):
:param extent: maximum size of the request
:param resolution: resolution of the grid on which the intersections will be precomputed
"""
if resolution is None:
resolution = (sp.asarray(self.size).max() + extent) / 4
if self.ndim == 2:
return
max_size = extent + sp.asarray(self.size).max() + resolution * np.sqrt(3.) / 2.
......@@ -607,7 +609,7 @@ __global__ void matrix_mult_nd_invert({dtype} *derparam, {dtype} *derfield, int
del self.backward_idx
idx_req, idx_centroids = self.basis.within_range(self.request)
forward_compressed = sp.append(0, sp.cumsum(sp.bincount(idx_req, minlength=self.request.npos)))
forward_idx = idx_centroids[sp.argsort(idx_req)]
forward_idx = idx_centroids# [sp.argsort(idx_req)]; idx_req is always sorted
self.forward_idx = (cuda.to_gpu_correct(forward_compressed),
cuda.to_gpu_correct(forward_idx))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment