Commit 522c81df authored by Martin Reinecke's avatar Martin Reinecke
Browse files

small tweaks

parent 5cf72d10
Pipeline #22472 passed with stage
in 4 minutes and 45 seconds
......@@ -74,7 +74,7 @@ class NonlinearPowerEnergy(Energy):
residual = self.d - \
self.Instrument(self.nonlinearity(
self.FFT.adjoint_times(self.power*sample)))
lh = 0.5 * residual.vdot(self.N.inverse_times(residual)).real
lh = 0.5 * residual.vdot(self.N.inverse_times(residual))
LinR = LinearizedPowerResponse(
self.Instrument, self.nonlinearity, self.FFT, self.Projection,
self.position, sample)
......
from .energy import Energy
from ..utilities import memo
class QuadraticEnergy(Energy):
......@@ -13,9 +12,12 @@ class QuadraticEnergy(Energy):
self._A = A
self._b = b
if _grad is not None:
self._Ax = _grad + self._b
self._grad = _grad
Ax = _grad + self._b
else:
self._Ax = self._A(self.position)
Ax = self._A(self.position)
self._grad = Ax - self._b
self._value = 0.5*self.position.vdot(Ax) - b.vdot(self.position)
def at(self, position):
return QuadraticEnergy(position=position, A=self._A, b=self._b)
......@@ -25,14 +27,12 @@ class QuadraticEnergy(Energy):
_grad=grad)
@property
@memo
def value(self):
return 0.5*self.position.vdot(self._Ax) - self._b.vdot(self.position)
return self._value
@property
@memo
def gradient(self):
return self._Ax - self._b
return self._grad
@property
def curvature(self):
......
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