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
66cf9aa5
Commit
66cf9aa5
authored
May 29, 2018
by
Martin Reinecke
Browse files
anticipate a few nice changes from symbolicDifferentiation
parent
8657bf15
Pipeline
#30032
passed with stages
in 9 minutes and 34 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
demos/nonlinear_wiener_filter.py
View file @
66cf9aa5
...
...
@@ -10,8 +10,8 @@ if __name__ == "__main__":
p_spec
=
lambda
k
:
(
1.
/
(
k
*
correlation_length
+
1
)
**
4
)
nonlinearity
=
Tanh
()
#nonlinearity = Linear()
#nonlinearity = Exponential()
#
nonlinearity = Linear()
#
nonlinearity = Exponential()
# Set up position space
s_space
=
ift
.
RGSpace
(
1024
)
...
...
nifty4/__init__.py
View file @
66cf9aa5
...
...
@@ -28,5 +28,5 @@ from .multi import *
__all__
=
[
"__version__"
,
"dobj"
,
"DomainTuple"
]
+
\
domains
.
__all__
+
operators
.
__all__
+
minimization
.
__all__
+
\
[
"DomainTuple"
,
"Field"
,
"sqrt"
,
"exp"
,
"log"
]
+
\
[
"DomainTuple"
,
"Field"
,
"sqrt"
,
"exp"
,
"log"
,
"tanh"
]
+
\
multi
.
__all__
nifty4/minimization/line_energy.py
View file @
66cf9aa5
...
...
@@ -97,5 +97,5 @@ class LineEnergy(object):
if
abs
(
res
.
imag
)
/
max
(
abs
(
res
.
real
),
1.
)
>
1e-12
:
from
..logger
import
logger
logger
.
warning
(
"directional derivative has non-negligible "
"imaginary part:
"
,
res
)
"imaginary part:
{}"
.
format
(
res
)
)
return
res
.
real
nifty4/minimization/scipy_minimizer.py
View file @
66cf9aa5
...
...
@@ -98,7 +98,7 @@ class ScipyMinimizer(Minimizer):
r
=
opt
.
minimize
(
hlp
.
fun
,
x
,
method
=
self
.
_method
,
jac
=
hlp
.
jac
,
hessp
=
hessp
,
options
=
self
.
_options
,
bounds
=
bounds
)
if
not
r
.
success
:
logger
.
error
(
"Problem in Scipy minimization:
"
,
r
.
message
)
logger
.
error
(
"Problem in Scipy minimization:
{}"
.
format
(
r
.
message
)
)
return
hlp
.
_energy
,
IterationController
.
ERROR
return
hlp
.
_energy
,
IterationController
.
CONVERGED
...
...
nifty4/operators/linear_operator.py
View file @
66cf9aa5
...
...
@@ -130,16 +130,22 @@ class LinearOperator(NiftyMetaBase()):
def
__mul__
(
self
,
other
):
from
.chain_operator
import
ChainOperator
if
np
.
isscalar
(
other
)
and
other
==
1.
:
return
self
other
=
self
.
_toOperator
(
other
,
self
.
domain
)
return
ChainOperator
.
make
([
self
,
other
])
def
__rmul__
(
self
,
other
):
from
.chain_operator
import
ChainOperator
if
np
.
isscalar
(
other
)
and
other
==
1.
:
return
self
other
=
self
.
_toOperator
(
other
,
self
.
target
)
return
ChainOperator
.
make
([
other
,
self
])
def
__add__
(
self
,
other
):
from
.sum_operator
import
SumOperator
if
np
.
isscalar
(
other
)
and
other
==
0.
:
return
self
other
=
self
.
_toOperator
(
other
,
self
.
domain
)
return
SumOperator
.
make
([
self
,
other
],
[
False
,
False
])
...
...
@@ -148,6 +154,8 @@ class LinearOperator(NiftyMetaBase()):
def
__sub__
(
self
,
other
):
from
.sum_operator
import
SumOperator
if
np
.
isscalar
(
other
)
and
other
==
0.
:
return
self
other
=
self
.
_toOperator
(
other
,
self
.
domain
)
return
SumOperator
.
make
([
self
,
other
],
[
False
,
True
])
...
...
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