Commit 00925e3
Fix Lagrangian Hessian prototype dimensions in OptimizationDIExt
The Lagrangian Hessian prototype was incorrectly sized as (num_constraints × num_variables)
instead of (num_variables × num_variables). This caused a `BoundsError` when computing the
Lagrangian Hessian with more variables than constraints, as the prototype was used as a
buffer for the n×n Hessian matrix.
Changes:
- Fix lag_hess_prototype initialization to use zeros(Bool, length(x), length(x))
in both in-place and out-of-place function instantiation
- Add tests to verify prototype dimensions
This ensures the Lagrangian Hessian is always correctly sized as n×n regardless of the
number of constraints, matching the mathematical definition of the Lagrangian Hessian
as the second derivative with respect to the decision variables.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 654f65f commit 00925e3
2 files changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
| 460 | + | |
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
0 commit comments