Skip to content

Commit

Permalink
forgot to update test
Browse files Browse the repository at this point in the history
  • Loading branch information
enzbus committed Jul 9, 2024
1 parent ff34737 commit ad1de86
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions project_euromir/tests/test_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _hessian_from_dresidual(cls, xy):
dres = cls._dresidual_linop(xy)
return sp.sparse.linalg.LinearOperator(
shape=(cls.n+cls.m, cls.n+cls.m),
matvec=lambda dxy: dres.T @ (dres @ (dxy * 2.)))
matvec=lambda dxy: dres.T @ (dres @ dxy ))

def test_gradient(self):
"""Test that the gradient is numerically accurate."""
Expand All @@ -129,7 +129,7 @@ def test_loss_residual(self):
xy = np.random.randn(self.n+self.m)
self.assertTrue(
np.isclose(self._loss(xy),
np.linalg.norm(self._residual(xy))**2))
np.linalg.norm(self._residual(xy))**2/2.))

def test_dr_drt(self):
"""Test that DR and DR^T are consistent."""
Expand All @@ -146,7 +146,7 @@ def test_dresidual_gradient(self):
np.random.seed(seed)
xy = np.random.randn(self.n+self.m)
grad = self._grad(xy)
newgrad = 2 * (self._dresidual_linop(xy).T @ self._residual(xy))
newgrad = (self._dresidual_linop(xy).T @ self._residual(xy))
self.assertTrue(np.allclose(grad, newgrad))

def test_dresidual_hessian(self):
Expand Down

0 comments on commit ad1de86

Please sign in to comment.