Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michiel Cottaar
gyral_structure
Commits
8a8e5e3c
Commit
8a8e5e3c
authored
May 03, 2020
by
Michiel Cottaar
Browse files
OPT: more minor speedup
parent
3be1558e
Pipeline
#5289
failed with stage
in 8 minutes and 45 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gyral_structure/basis/radial.py
View file @
8a8e5e3c
...
...
@@ -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
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment