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
1a1822c3
Commit
1a1822c3
authored
Jun 15, 2018
by
Philipp Arras
Browse files
Cosmetics
parent
9f23622d
Pipeline
#31069
passed with stages
in 1 minute and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty4/nonlinear_operators/local_nonlinearity.py
View file @
1a1822c3
...
...
@@ -9,15 +9,12 @@ class LocalModel(NonlinearOperator):
Computes nonlinearity(inp)
"""
super
(
LocalModel
,
self
).
__init__
(
position
)
self
.
_inp
=
inp
.
at
(
self
.
position
)
self
.
_nonlinearity
=
nonlinearity
self
.
_value
=
nonlinearity
(
self
.
_inp
.
value
)
# Gradient
self
.
_gradient
=
makeOp
(
self
.
_nonlinearity
.
derivative
(
self
.
_inp
.
value
))
*
self
.
_inp
.
gradient
d_inner
=
self
.
_inp
.
gradient
d_outer
=
makeOp
(
self
.
_nonlinearity
.
derivative
(
self
.
_inp
.
value
))
self
.
_gradient
=
d_outer
*
d_inner
def
at
(
self
,
position
):
return
self
.
__class__
(
position
,
self
.
_inp
,
self
.
_nonlinearity
)
nifty4/nonlinear_operators/nonlinear_operator.py
View file @
1a1822c3
...
...
@@ -26,7 +26,6 @@ class NonlinearOperator(object):
sel
=
SelectionOperator
(
self
.
value
.
domain
,
key
)
return
sel
(
self
)
# TODO Support addition and multiplication with fields
def
__add__
(
self
,
other
):
assert
isinstance
(
other
,
NonlinearOperator
)
return
Add
.
make
(
self
,
other
)
...
...
@@ -135,7 +134,6 @@ class LinearModel(NonlinearOperator):
self
.
_lin_op
=
lin_op
self
.
_inp
=
inp
# FIXME This is a dirty hack!
if
isinstance
(
self
.
_lin_op
,
SelectionOperator
):
self
.
_lin_op
=
SelectionOperator
(
self
.
_inp
.
value
.
domain
,
self
.
_lin_op
.
_key
)
...
...
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