Skip to content
GitLab
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
9483e218
Commit
9483e218
authored
Dec 21, 2018
by
Jakob Knollmueller
Browse files
derivative for clip added
parent
37f9b9b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/linearization.py
View file @
9483e218
...
...
@@ -7,6 +7,7 @@ from .compat import *
from
.field
import
Field
from
.multi_field
import
MultiField
from
.sugar
import
makeOp
from
.operators.scaling_operator
import
ScalingOperator
class
Linearization
(
object
):
...
...
@@ -189,7 +190,14 @@ class Linearization(object):
def
clip
(
self
,
min
=
None
,
max
=
None
):
tmp
=
self
.
_val
.
clip
(
min
,
max
)
tmp2
=
makeOp
(
1.
-
(
tmp
==
eps
))
if
(
min
is
None
)
and
(
max
is
None
):
tmp2
=
ScalingOperator
(
1
,
self
.
_val
.
domain
)
elif
max
is
None
:
tmp2
=
makeOp
(
1.
-
(
tmp
==
min
))
elif
min
is
None
:
tmp2
=
makeOp
(
1.
-
(
tmp
==
max
))
else
:
tmp2
=
makeOp
(
1.
-
(
tmp
==
min
)
-
(
tmp
==
max
))
return
self
.
new
(
tmp
,
tmp2
(
self
.
_jac
))
def
sin
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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