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
Neel Shah
NIFTy
Commits
3de57d9c
Commit
3de57d9c
authored
May 31, 2021
by
Philipp Arras
Browse files
KLMetric -> SelfAdjointOperatorWrapper
parent
a2ccbfa2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/minimization/kl_energies.py
View file @
3de57d9c
...
...
@@ -97,15 +97,16 @@ def _reduce_by_keys(field, operator, keys):
return
field
,
operator
class
_KLMetric
(
EndomorphicOperator
):
def
__init__
(
self
,
KL
):
self
.
_KL
=
KL
class
_SelfAdjointOperatorWrapper
(
EndomorphicOperator
):
def
__init__
(
self
,
domain
,
func
):
from
..sugar
import
makeDomain
self
.
_func
=
func
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
self
.
_domain
=
KL
.
position
.
domain
self
.
_domain
=
makeDomain
(
domain
)
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
return
self
.
_
KL
.
apply_metri
c
(
x
)
return
self
.
_
fun
c
(
x
)
class
_SampledKLEnergy
(
Energy
):
...
...
@@ -175,7 +176,8 @@ class _SampledKLEnergy(Energy):
@
property
def
metric
(
self
):
return
_KLMetric
(
self
)
return
_SelfAdjointOperatorWrapper
(
self
.
position
.
domain
,
self
.
apply_metric
)
@
property
def
samples
(
self
):
...
...
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