Skip to content

Conversation

@Transurgeon
Copy link
Member

  • Add _jacobian() and _hess_vec() methods to diag_vec atom for NLP support
  • Fix diagonal variable value propagation in CvxAttr2Constr reduction
  • Add tests for diagonal variables in NLP problems

The diag_vec Jacobian maps input vector positions to diagonal matrix positions using the formula i*(n+1) for Fortran-order flattening.

- Add _jacobian() and _hess_vec() methods to diag_vec atom for NLP support
- Fix diagonal variable value propagation in CvxAttr2Constr reduction
- Add tests for diagonal variables in NLP problems

The diag_vec Jacobian maps input vector positions to diagonal matrix
positions using the formula i*(n+1) for Fortran-order flattening.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Jan 19, 2026

Benchmarks that have stayed the same:

   before           after         ratio
 [07bd2721]       [abedd814]
      12.8±0s          13.2±0s     1.03  finance.CVaRBenchmark.time_compile_problem
      2.82±0s          2.88±0s     1.02  quantum_hilbert_matrix.QuantumHilbertMatrix.time_compile_problem
      287±0ms          292±0ms     1.02  matrix_stuffing.ParamSmallMatrixStuffing.time_compile_problem
      145±0ms          147±0ms     1.01  high_dim_convex_plasticity.ConvexPlasticity.time_compile_problem
      237±0ms          239±0ms     1.01  simple_QP_benchmarks.SimpleQPBenchmark.time_compile_problem
      11.4±0s          11.5±0s     1.01  simple_LP_benchmarks.SimpleLPBenchmark.time_compile_problem
      1.45±0s          1.46±0s     1.01  matrix_stuffing.ParamConeMatrixStuffing.time_compile_problem
      4.31±0s          4.34±0s     1.01  huber_regression.HuberRegression.time_compile_problem
      821±0ms          826±0ms     1.01  simple_QP_benchmarks.LeastSquares.time_compile_problem
      4.89±0s          4.91±0s     1.01  svm_l1_regularization.SVMWithL1Regularization.time_compile_problem
      314±0ms          315±0ms     1.00  gini_portfolio.Yitzhaki.time_compile_problem
      231±0ms          232±0ms     1.00  gini_portfolio.Murray.time_compile_problem
      4.97±0s          4.97±0s     1.00  optimal_advertising.OptimalAdvertising.time_compile_problem
      1.60±0s          1.59±0s     1.00  tv_inpainting.TvInpainting.time_compile_problem
      1.86±0s          1.85±0s     1.00  simple_QP_benchmarks.UnconstrainedQP.time_compile_problem
     13.8±0ms         13.8±0ms     1.00  simple_LP_benchmarks.SimpleFullyParametrizedLPBenchmark.time_compile_problem
     39.3±0ms         39.1±0ms     1.00  matrix_stuffing.SmallMatrixStuffing.time_compile_problem
      670±0ms          666±0ms     0.99  matrix_stuffing.ConeMatrixStuffingBench.time_compile_problem
      22.4±0s          22.3±0s     0.99  sdp_segfault_1132_benchmark.SDPSegfault1132Benchmark.time_compile_problem
      511±0ms          507±0ms     0.99  semidefinite_programming.SemidefiniteProgramming.time_compile_problem
      1.11±0s          1.10±0s     0.99  gini_portfolio.Cajas.time_compile_problem
      284±0ms          280±0ms     0.99  slow_pruning_1668_benchmark.SlowPruningBenchmark.time_compile_problem
     14.4±0ms         14.2±0ms     0.98  simple_QP_benchmarks.ParametrizedQPBenchmark.time_compile_problem
      1.04±0s          1.03±0s     0.98  finance.FactorCovarianceModel.time_compile_problem
      904±0ms          886±0ms     0.98  simple_LP_benchmarks.SimpleScalarParametrizedLPBenchmark.time_compile_problem

When a diag variable has its value stored as a sparse matrix (e.g., after
solving), np.diag() fails on it. This adds a check for sparse values and
uses .diagonal() to extract the diagonal elements correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dance858
Copy link
Collaborator

Awesome! DNLP takes care of its favorite customer @maxschaller

@dance858 dance858 merged commit 6af3241 into master Jan 19, 2026
11 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants