Commit af1d849c authored by Martin Reinecke's avatar Martin Reinecke
Browse files

Merge branch 'operator_work_pa' into 'NIFTy_5'

Operator work pa

See merge request ift/nifty-dev!52
parents 0456ca2e 590128e1
......@@ -44,13 +44,10 @@ def make_correlated_field(s_space, amplitude_model):
ht = HartleyOperator(h_space, s_space)
p_space = amplitude_model.value.domain[0]
power_distributor = PowerDistributor(h_space, p_space)
# FIXME Remove tau and phi stuff from here. Should not be necessary
position = MultiField.from_dict({
'xi': Field.from_random('normal', h_space),
'tau': amplitude_model.position['tau'],
'phi': amplitude_model.position['phi']})
position = MultiField.from_dict({'xi': Field.full(h_space, 0.)})
xi = Variable(position)['xi']
A = power_distributor(amplitude_model)
correlated_field_h = A * xi
correlated_field = ht(correlated_field_h)
......
......@@ -61,7 +61,7 @@ class GaussianEnergy(Energy):
@property
@memo
def gradient(self):
return self._inp.jacobian.adjoint_times(self._icovres)
return self._inp.jacobian.adjoint_times(self._icovres).real
@property
@memo
......
......@@ -37,9 +37,11 @@ class EnergySum(Energy):
eout = []
fout = []
EnergySum._unpackEnergies(energies, factors, 1., eout, fout)
for e in eout[1:]:
if not e.position.isEquivalentTo(eout[0].position):
raise ValueError("position mismatch")
# FIXME we need to reach an agreement about how we want to deal
# with domain and field compatibility. Until then, we relax te check.
# for e in eout[1:]:
# if not e.position.isEquivalentTo(eout[0].position):
# raise ValueError("position mismatch")
return EnergySum(eout[0].position, eout, fout)
@staticmethod
......
......@@ -53,5 +53,5 @@ class EnergySum_Tests(unittest.TestCase):
E1+2
with assert_raises(TypeError):
E1-"hello"
with assert_raises(ValueError):
E1+E2.at(2*pos)
# with assert_raises(ValueError):
# E1+E2.at(2*pos)
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