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
f8c5c895
Commit
f8c5c895
authored
Jun 18, 2018
by
Philipp Arras
Browse files
Add UnitLogGauss
parent
55112079
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty4/library/unit_log_gauss.py
0 → 100644
View file @
f8c5c895
from
..minimization
import
Energy
from
..operators
import
InversionEnabler
,
SandwichOperator
from
..utilities
import
memo
class
UnitLogGauss
(
Energy
):
def
__init__
(
self
,
position
,
s
,
inverter
=
None
):
"""
s: Sky model object
value = 0.5 * s.vdot(s), i.e. a log-Gauss distribution with unit
covariance
"""
super
(
UnitLogGauss
,
self
).
__init__
(
position
)
self
.
_s
=
s
.
at
(
position
)
self
.
_inverter
=
inverter
def
at
(
self
,
position
):
return
self
.
__class__
(
position
,
self
.
_s
,
self
.
_inverter
)
@
property
@
memo
def
_gradient_helper
(
self
):
return
self
.
_s
.
gradient
@
property
@
memo
def
value
(
self
):
return
.
5
*
self
.
_s
.
value
.
vdot
(
self
.
_s
.
value
)
@
property
@
memo
def
gradient
(
self
):
return
self
.
_gradient_helper
.
adjoint
(
self
.
_s
.
value
)
@
property
@
memo
def
curvature
(
self
):
c
=
SandwichOperator
.
make
(
self
.
_gradient_helper
)
if
self
.
_inverter
is
None
:
return
c
return
InversionEnabler
(
c
,
self
.
_inverter
)
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