Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
aab0727b
Commit
aab0727b
authored
Jul 13, 2017
by
Theo Steininger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added cache for FFTOperator in SmoothingOperator
parent
2ce4c8dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
nifty/operators/smoothing_operator/fft_smoothing_operator.py
nifty/operators/smoothing_operator/fft_smoothing_operator.py
+21
-4
No files found.
nifty/operators/smoothing_operator/fft_smoothing_operator.py
View file @
aab0727b
...
...
@@ -8,12 +8,21 @@ from .smoothing_operator import SmoothingOperator
class
FFTSmoothingOperator
(
SmoothingOperator
):
def
_smooth
(
self
,
x
,
spaces
,
inverse
):
Transformator
=
FFTOperator
(
x
.
domain
[
spaces
[
0
]])
def
__init__
(
self
,
domain
,
sigma
,
log_distances
=
False
,
default_spaces
=
None
):
super
(
FFTSmoothingOperator
,
self
).
__init__
(
domain
=
domain
,
sigma
=
sigma
,
log_distances
=
log_distances
,
default_spaces
=
default_spaces
)
self
.
_transformator_cache
=
{}
def
_smooth
(
self
,
x
,
spaces
,
inverse
):
# transform to the (global-)default codomain and perform all remaining
# steps therein
transformed_x
=
Transformator
(
x
,
spaces
=
spaces
)
transformator
=
self
.
_get_transformator
(
x
.
dtype
)
transformed_x
=
transformator
(
x
,
spaces
=
spaces
)
codomain
=
transformed_x
.
domain
[
spaces
[
0
]]
coaxes
=
transformed_x
.
domain_axes
[
spaces
[
0
]]
...
...
@@ -51,9 +60,17 @@ class FFTSmoothingOperator(SmoothingOperator):
transformed_x
.
val
.
set_local_data
(
local_transformed_x
,
copy
=
False
)
smoothed_x
=
Transformator
.
adjoint_times
(
transformed_x
,
spaces
=
spaces
)
smoothed_x
=
transformator
.
adjoint_times
(
transformed_x
,
spaces
=
spaces
)
result
=
x
.
copy_empty
()
result
.
set_val
(
smoothed_x
,
copy
=
False
)
return
result
def
_get_transformator
(
self
,
dtype
):
if
dtype
not
in
self
.
_transformator_cache
:
self
.
_transformator_cache
[
dtype
]
=
FFTOperator
(
self
.
domain
,
domain_dtype
=
dtype
,
target
=
np
.
complex
)
return
self
.
_transformator_cache
[
dtype
]
Write
Preview
Markdown
is supported
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