Commit b1a9f4fa authored by Philipp Arras's avatar Philipp Arras
Browse files

Make quadratic energy real

parent 5e993f95
Pipeline #73466 passed with stages
in 19 minutes and 52 seconds
......@@ -34,9 +34,9 @@ class QuadraticEnergy(Energy):
else:
Ax = self._A(self._position)
self._grad = Ax if b is None else Ax - b
self._value = 0.5*self._position.s_vdot(Ax)
self._value = 0.5*self._position.s_vdot(Ax).real
if b is not None:
self._value -= b.s_vdot(self._position)
self._value -= b.s_vdot(self._position).real
def at(self, position):
return QuadraticEnergy(position, self._A, self._b)
......
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