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
537fb1a6
Commit
537fb1a6
authored
Oct 02, 2019
by
Reimar H Leike
Browse files
fixup
parent
1f598ab5
Pipeline
#61339
passed with stages
in 9 minutes and 29 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/minimization/descent_minimizers.py
View file @
537fb1a6
...
...
@@ -187,8 +187,8 @@ class NewtonCG(DescentMinimizer):
e
=
QuadraticEnergy
(
0
*
energy
.
position
,
energy
.
metric
,
energy
.
gradient
)
p
=
None
if
self
.
_napprox
>
1
:
unscmet
,
sc
=
energy
.
unscaled_
metric
()
p
=
makeOp
(
approximation2endo
(
unsc
met
,
self
.
_napprox
)
*
sc
).
inverse
met
=
energy
.
metric
p
=
makeOp
(
approximation2endo
(
met
,
self
.
_napprox
)).
inverse
e
,
conv
=
ConjugateGradient
(
ic
,
nreset
=
self
.
_nreset
)(
e
,
p
)
return
-
e
.
position
...
...
nifty5/minimization/metric_gaussian_kl_mpi.py
View file @
537fb1a6
...
...
@@ -23,7 +23,7 @@ from .energy import Energy
from
mpi4py
import
MPI
import
numpy
as
np
from
..probing
import
approximation2endo
from
..sugar
import
makeOp
from
..sugar
import
makeOp
,
full
from
..field
import
Field
from
..multi_field
import
MultiField
...
...
@@ -70,7 +70,7 @@ class KLMetric(EndomorphicOperator):
return
self
.
_KL
.
apply_metric
(
x
)
def
draw_sample
(
self
,
from_inverse
=
False
,
dtype
=
np
.
float64
):
self
.
_KL
.
metric_sample
(
from_inverse
,
dtype
)
return
self
.
_KL
.
metric_sample
(
from_inverse
,
dtype
)
...
...
@@ -241,9 +241,9 @@ class MetricGaussianKL_MPI(Energy):
if
from_inverse
:
raise
NotImplementedError
()
lin
=
self
.
_lin
.
with_want_metric
()
samp
=
ift
.
full
(
self
.
_hamiltonian
.
domain
,
0.
)
for
s
in
self
.
_samples
:
samp
=
samp
+
self
.
_hamiltonian
(
lin
+
v
).
metric
.
draw_sample
(
dtype
)
samp
=
full
(
self
.
_hamiltonian
.
domain
,
0.
)
for
v
in
self
.
_samples
:
samp
=
samp
+
self
.
_hamiltonian
(
lin
+
v
).
metric
.
draw_sample
(
from_inverse
=
False
,
dtype
=
dtype
)
return
allreduce_sum_field
(
samp
)
def
metric_sample
(
self
,
from_inverse
=
False
,
dtype
=
np
.
float64
):
...
...
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