Skip to content

Commit

Permalink
Hackedy hack
Browse files Browse the repository at this point in the history
  • Loading branch information
mlondschien committed Jul 5, 2024
1 parent ea54099 commit 2674d59
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ivmodels/tests/lagrange_multiplier.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,13 @@ def derivative(self, beta, gamma=None, jac_and_hess=True):
St = self.yS[:, 1:] - np.outer(residuals, Sigma)
St_orth = St - St_proj

mat = St_proj.T @ St_proj
cond = np.linalg.cond(mat)
if cond > 1e12:
mat += 1e-6 * np.eye(mat.shape[0])

solved = np.linalg.solve(
St_proj.T @ St_proj,
mat,
np.hstack(
[
St_proj.T @ residuals_proj.reshape(-1, 1),
Expand Down

0 comments on commit 2674d59

Please sign in to comment.