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
ift
NIFTy
Commits
729b67fc
Commit
729b67fc
authored
Jun 22, 2018
by
Philipp Arras
Browse files
Performance tweak
parent
eef0b9c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/model_gradient_operator.py
View file @
729b67fc
...
...
@@ -75,9 +75,9 @@ class ModelGradientOperator(LinearOperator):
for
dd
in
self
.
domain
:
if
dd
in
grad_keys
:
res
[
dd
]
=
self
.
_gradients
[
dd
].
adjoint_times
(
x
)
else
:
res
[
dd
]
=
full
(
self
.
domain
[
dd
],
0.
)
#
else:
#
res[dd] = full(self.domain[dd], 0.)
res
=
MultiField
(
res
)
if
not
res
.
domain
==
self
.
domain
:
raise
TypeError
#
if not res.domain == self.domain:
#
raise TypeError
return
res
nifty5/operators/selection_operator.py
View file @
729b67fc
...
...
@@ -41,9 +41,10 @@ class SelectionOperator(LinearOperator):
return
self
.
TIMES
|
self
.
ADJOINT_TIMES
def
apply
(
self
,
x
,
mode
):
# FIXME Is the copying necessary?
self
.
_check_input
(
x
,
mode
)
if
mode
==
self
.
TIMES
:
return
x
[
self
.
_key
].
copy
()
else
:
from
..multi
import
MultiField
return
MultiField
({
self
.
_key
:
x
})
return
MultiField
({
self
.
_key
:
x
.
copy
()
})
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