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
9cc3f112
Commit
9cc3f112
authored
Jun 29, 2018
by
Martin Reinecke
Browse files
fix invocation of curvature tests; provide some missing MultiField functionality
parent
3d2ba0d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
nifty5/library/gaussian_energy.py
View file @
9cc3f112
...
...
@@ -61,4 +61,6 @@ class GaussianEnergy(Energy):
@
property
@
memo
def
curvature
(
self
):
if
self
.
_cov
is
None
:
return
SandwichOperator
.
make
(
self
.
_inp
.
gradient
,
None
)
return
SandwichOperator
.
make
(
self
.
_inp
.
gradient
,
self
.
_cov
.
inverse
)
nifty5/multi/multi_field.py
View file @
9cc3f112
...
...
@@ -164,10 +164,25 @@ class MultiField(object):
def
__neg__
(
self
):
return
MultiField
({
key
:
-
val
for
key
,
val
in
self
.
items
()})
def
__abs__
(
self
):
return
MultiField
({
key
:
abs
(
val
)
for
key
,
val
in
self
.
items
()})
def
conjugate
(
self
):
return
MultiField
({
key
:
sub_field
.
conjugate
()
for
key
,
sub_field
in
self
.
items
()})
def
all
(
self
):
for
v
in
self
.
values
():
if
not
v
.
all
():
return
False
return
True
def
any
(
self
):
for
v
in
self
.
values
():
if
v
.
any
():
return
True
return
False
def
isEquivalentTo
(
self
,
other
):
"""Determines (as quickly as possible) whether `self`'s content is
identical to `other`'s content."""
...
...
test/test_energies/test_map.py
View file @
9cc3f112
...
...
@@ -93,7 +93,7 @@ class Energy_Tests(unittest.TestCase):
N
=
None
energy
=
ift
.
GaussianEnergy
(
d_model
,
d
,
N
)
if
isinstance
(
nonlinearity
,
ift
.
Linear
):
if
isinstance
(
nonlinearity
()
,
ift
.
Linear
):
ift
.
extra
.
check_value_gradient_curvature_consistency
(
energy
,
ntries
=
10
)
else
:
...
...
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