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
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
ift
NIFTy
Commits
2add9edd
Commit
2add9edd
authored
Jun 14, 2018
by
Reimar H Leike
Browse files
added preconditioning to sampling enabler
parent
5512b99a
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty4/library/wiener_filter_curvature.py
View file @
2add9edd
...
...
@@ -46,7 +46,7 @@ def WienerFilterCurvature(R, N, S, inverter, sampling_inverter=None):
"""
M
=
SandwichOperator
.
make
(
R
,
N
.
inverse
)
if
sampling_inverter
is
not
None
:
op
=
SamplingEnabler
(
M
,
S
.
inverse
,
sampling_inverter
)
op
=
SamplingEnabler
(
M
,
S
.
inverse
,
sampling_inverter
,
approximation
=
S
.
inverse
)
else
:
op
=
M
+
S
.
inverse
return
InversionEnabler
(
op
,
inverter
,
S
.
inverse
)
nifty4/operators/sampling_enabler.py
View file @
2add9edd
...
...
@@ -50,6 +50,7 @@ class SamplingEnabler(EndomorphicOperator):
self
.
_likelihood
=
likelihood
self
.
_prior
=
prior
self
.
_sampling_inverter
=
sampling_inverter
self
.
_approximation
=
approximation
def
draw_sample
(
self
,
from_inverse
=
False
,
dtype
=
np
.
float64
):
try
:
...
...
@@ -60,7 +61,7 @@ class SamplingEnabler(EndomorphicOperator):
nj
=
self
.
_likelihood
.
draw_sample
()
energy
=
QuadraticEnergy
(
s
,
self
.
_op
,
sp
+
nj
,
_grad
=
self
.
_likelihood
(
s
)
-
nj
)
energy
,
convergence
=
self
.
_sampling_inverter
(
energy
)
energy
,
convergence
=
self
.
_sampling_inverter
(
energy
,
preconditioner
=
self
.
_approximation
.
inverse
)
return
energy
.
position
@
property
...
...
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