Commit 065ec7ac authored by Philipp Arras's avatar Philipp Arras

Simplify for non_constant input to Hamiltonian

parent 12f34692
......@@ -319,9 +319,11 @@ class StandardHamiltonian(EnergyOperator):
`<https://arxiv.org/abs/1812.04403>`_
"""
def __init__(self, lh, ic_samp=None):
def __init__(self, lh, ic_samp=None, _c_inp=None):
self._lh = lh
self._prior = GaussianEnergy(domain=lh.domain)
if _c_inp is not None:
_, self._prior = self._prior.simplify_for_constant_input(_c_inp)
self._ic_samp = ic_samp
self._domain = lh.domain
......@@ -338,9 +340,13 @@ class StandardHamiltonian(EnergyOperator):
def __repr__(self):
subs = 'Likelihood:\n{}'.format(utilities.indent(self._lh.__repr__()))
subs += '\nPrior: Quadratic{}'.format(self._lh.domain.keys())
subs += '\nPrior:\n{}'.format(self._prior)
return 'StandardHamiltonian:\n' + utilities.indent(subs)
def _simplify_for_constant_input_nontrivial(self, c_inp):
out, lh1 = self._lh.simplify_for_constant_input(c_inp)
return out, StandardHamiltonian(lh1, self._ic_samp, _c_inp=c_inp)
class AveragedEnergy(EnergyOperator):
"""Averages an energy over samples.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment