Skip to content

Commit

Permalink
Fix the sign error in wide QR factorization (#1181)
Browse files Browse the repository at this point in the history
When Jacobian is wide, instead of decomposing $\mathbf{J=QR}$, we do
$\mathbf{J^T=QR}$. This later requires solving
$$\mathbf{J}x= -f $$
$$\mathbf{R}^T \mathbf{Q}^Tx = - f $$
$$\mathbf{R}^Tv = - f, \hspace{1cm} \text{where } v = \mathbf{Q}^Tx$$
$$x = \mathbf{Q}v$$
where we call `p_newton` to `x`.
  • Loading branch information
YigitElma authored Aug 14, 2024
2 parents 5c309d8 + b9ba0be commit db9107b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion desc/optimize/tr_subproblems.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def trust_region_step_exact_qr(
p_newton = solve_triangular_regularized(R, -Q.T @ f)
else:
Q, R = qr(J.T, mode="economic")
p_newton = Q @ solve_triangular_regularized(R.T, f, lower=True)
p_newton = Q @ solve_triangular_regularized(R.T, -f, lower=True)

def truefun(*_):
return p_newton, False, 0.0
Expand Down

0 comments on commit db9107b

Please sign in to comment.