Skip to content

Centralize sparsediffpy import into _bindings.py#174

Merged
Transurgeon merged 4 commits intomasterfrom
more-pr-comments
Mar 4, 2026
Merged

Centralize sparsediffpy import into _bindings.py#174
Transurgeon merged 4 commits intomasterfrom
more-pr-comments

Conversation

@Transurgeon
Copy link
Member

Move the duplicated try/except import of sparsediffpy from c_problem.py and converters.py into a single _bindings.py module.

Description

Please include a short summary of the change.
Issue link (if applicable):

Type of change

  • New feature (backwards compatible)
  • New feature (breaking API changes)
  • Bug fix
  • Other (Documentation, CI, ...)

Contribution checklist

  • Add our license to new files.
  • Check that your code adheres to our coding style.
  • Write unittests.
  • Run the unittests and check that they’re passing.
  • Run the benchmarks to make sure your change doesn’t introduce a regression.

Move the duplicated try/except import of sparsediffpy from c_problem.py
and converters.py into a single _bindings.py module.

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

github-actions bot commented Mar 4, 2026

Benchmarks that have improved:

   before           after         ratio
 [ce8fda13]       [3f54d9cb]
  •     300±0ms          256±0ms     0.85  simple_QP_benchmarks.SimpleQPBenchmark.time_compile_problem
    
  •     853±0ms          721±0ms     0.84  simple_QP_benchmarks.LeastSquares.time_compile_problem
    
  •     1.37±0s          1.12±0s     0.82  gini_portfolio.Cajas.time_compile_problem
    

Benchmarks that have stayed the same:

   before           after         ratio
 [ce8fda13]       [3f54d9cb]
      492±0ms          524±0ms     1.06  semidefinite_programming.SemidefiniteProgramming.time_compile_problem
      13.3±0s          14.1±0s     1.06  finance.CVaRBenchmark.time_compile_problem
      1.53±0s          1.58±0s     1.03  tv_inpainting.TvInpainting.time_compile_problem
     37.7±0ms         38.4±0ms     1.02  matrix_stuffing.SmallMatrixStuffing.time_compile_problem
      286±0ms          291±0ms     1.02  matrix_stuffing.ParamSmallMatrixStuffing.time_compile_problem
      1.47±0s          1.49±0s     1.02  matrix_stuffing.ParamConeMatrixStuffing.time_compile_problem
      9.88±0s          10.0±0s     1.01  simple_LP_benchmarks.SimpleLPBenchmark.time_compile_problem
     15.3±0ms         15.5±0ms     1.01  simple_LP_benchmarks.SimpleFullyParametrizedLPBenchmark.time_compile_problem
      277±0ms          279±0ms     1.01  slow_pruning_1668_benchmark.SlowPruningBenchmark.time_compile_problem
      4.53±0s          4.57±0s     1.01  svm_l1_regularization.SVMWithL1Regularization.time_compile_problem
      134±0ms          135±0ms     1.01  high_dim_convex_plasticity.ConvexPlasticity.time_compile_problem
      1.00±0s          1.01±0s     1.01  finance.FactorCovarianceModel.time_compile_problem
      5.47±0s          5.48±0s     1.00  optimal_advertising.OptimalAdvertising.time_compile_problem
      4.00±0s          4.01±0s     1.00  huber_regression.HuberRegression.time_compile_problem
      336±0ms          337±0ms     1.00  gini_portfolio.Yitzhaki.time_compile_problem
      239±0ms          239±0ms     1.00  gini_portfolio.Murray.time_compile_problem
      682±0ms          681±0ms     1.00  matrix_stuffing.ConeMatrixStuffingBench.time_compile_problem
      890±0ms          888±0ms     1.00  simple_LP_benchmarks.SimpleScalarParametrizedLPBenchmark.time_compile_problem
      21.5±0s          21.4±0s     1.00  sdp_segfault_1132_benchmark.SDPSegfault1132Benchmark.time_compile_problem
     15.6±0ms         15.5±0ms     0.99  simple_QP_benchmarks.ParametrizedQPBenchmark.time_compile_problem
      2.63±0s          2.54±0s     0.96  quantum_hilbert_matrix.QuantumHilbertMatrix.time_compile_problem
      1.91±0s          1.82±0s     0.95  simple_QP_benchmarks.UnconstrainedQP.time_compile_problem

@Transurgeon Transurgeon merged commit 2a492a7 into master Mar 4, 2026
45 of 47 checks passed
@Transurgeon Transurgeon deleted the more-pr-comments branch March 4, 2026 22:18
Transurgeon added a commit that referenced this pull request Mar 10, 2026
* adding experiments for ipopt with a cvxpy

* fixing jacobian sign and putting the constraints in standard form

* adding some refactoring for automatically calculating bounds

* adds two more examples

* adding base files for interface

* fix rosenbrock with multiple variables

* beginning testing on MLE estimation but encountering errors

* fixes test for mle-estimation, thanks parth!

* fixing mle with constraints, but need to generalize

* add new example and attempt to fix the jacobian variable ordering issue

* refactor the normalization of constraints

* adding new examples and refactoring bounds calculation

* fix issue with bounds creation

* finish up a portfolio example

* add example for max

* initial attempts at adding a smooth canon for maximum, what's left?

* test with more complex example

* testing reduction and it seems to work!

* Merge pull request #3 from cvxgrp/working-on-smooth-canons

adding more smooth canonicalizers

* Adding IPOPT interface as NLP solver (#4)

* adds oracles and bounds class to ipopt interface

* adds some settings and solver lists changes for IPOPT

* adds nlp solver option and can call ipopt

* adds more experiments for integrating ipopt as a solver interface

* passing the problem through the inversion

* add some more extra changes

* adding nlmatrixstuffing

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* fix interface issues thanks to parth (#5)

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* adding unit-tests and improvements to NLP interface. (#6)

* adding many tests, new smoothcanon for min, and improvements to ipopt_nlpif

* fixing last two tests

* add another example, qcp

* adding example for acopf

* add control of a car example done

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* update solution statuses thanks to odow (#8)

* update solution statuses thanks to odow

* removes unusued solver information

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Adding non-linear example of rocket control (#7)

* getting rocket landing example to work

* add changes to the jacobian computation

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* adding many more example of non-convex functions (#11)

* adding many more example of non-convex functions

* making lots of progress on understanding good canonicalizations

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* adding some more tests (#12)

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* fix ruff complaints

* Smith form affine (#13)

* adding cleaning up of torch

* adding jacobian structure and jacobian only value computation in interface

* making analytic center of ellipsoid work

* much more progress on everything, sparse jacobians and smith form

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Fix matmul gradient issue (#14)

* fix matmul grad

* fix matmul and add sparsity in blocks

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* added div and some other small changes (#15)

* sparse Jacobian via dok (#16)

* div canon stuff (#17)

* cleaning up the sandbox and adding more test problems to the test suite (#19)

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* first order deriv check (#21)

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Setting up smith form for non-affine expressions. (#20)

* adding real smith form and making all tests pass

* fixes failing test by flattening in right order

* comment out smith form for now

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Allow matrix variables (#26)

* fixing matrix variables

* add some refactors

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Bounds investigation (#29)

* div canon stuff

* some test problems in sandbox

* preparing for merge

* some progress

* weird value check

* stress test ML zero mean passes

* very subtle implementation details. MLE stress test (with and without zero mean) work

* minor

* fixed dimension error inside div-canon and added Sharpe ratio as a test

* fixing some linting issues

* more fixing imports

* fixing final imports, giving up

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Experiment: Hessian of the lagrangian (#31)

* attempting outline for hessian

* first draft at a hessian

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>
Co-authored-by: Daniel Cederberg <101940375+dance858@users.noreply.github.com>

* Bounds investigation (#33)

* div canon stuff

* some test problems in sandbox

* preparing for merge

* some progress

* weird value check

* stress test ML zero mean passes

* very subtle implementation details. MLE stress test (with and without zero mean) work

* minor

* fixed dimension error inside div-canon and added Sharpe ratio as a test

* fixing some linting issues

* more fixing imports

* fixing final imports, giving up

* added entropy related atoms

* merge fix

* merge fix

* More LICQ-friendly abs formulation

---------

Co-authored-by: Daniel <danielcederberg1@gmail.com>
Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* comment out hessian stuff

* small changes to log

* canonicalization for exp, and nelson siegel model fitting (#34)

* canonicalization for exp, and nelson siegel model fitting

* add value propagation

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Adding solver options (#42)

* add number of iterations

* adding better handling of solver options

* setting default print level to 3

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* fixing ruff warnings (#35)

* raising error for unimplemented smooth canons

* fixed ruff warnings

* Revert "raising error for unimplemented smooth canons"

This reverts commit f17e5dd7be3c8df42be0243b165dca37090b46cb.

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>
Co-authored-by: Daniel <danielcederberg1@gmail.com>
Co-authored-by: Daniel Cederberg <101940375+dance858@users.noreply.github.com>

* Hessian (#38)

* hessian progress

* getting hessian to work for simple formulation of MLE

* much more progress on hessian, getting mle non-zero mean to work with smith formulation

* fixing test pass for sharpe ratio

* making analytic center pass with hessian

* prepare for merge

---------

Co-authored-by: Daniel <danielcederberg1@gmail.com>
Co-authored-by: William Zijie Zhang <william@gridmatic.com>
Co-authored-by: Daniel Cederberg <101940375+dance858@users.noreply.github.com>

* Hessian (#43)

* hessian progress

* getting hessian to work for simple formulation of MLE

* much more progress on hessian, getting mle non-zero mean to work with smith formulation

* fixing test pass for sharpe ratio

* making analytic center pass with hessian

* prepare for merge

* started with new abstraction, added some tests

* adding hess_vecs

* hess-vec for multiply and some tests

* hess vec for multiply

* hessian for add expression

* hessian for sum atom

* hessian index operator

* hessian relative entropy

* updated hessian oracle with the new abstraction

* small change to gradient

* fixed William's code review

* fix import blocks

* change name of verification of hess args method

* remove nelson siegel

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>
Co-authored-by: William Zijie Zhang <89562186+Transurgeon@users.noreply.github.com>

* setting up infrastructure for testing NLP on CI

* fixing all not-implemented hessian issues (#45)

* fixing all not-implemented hessian issues

* making some tests pass with hessian_approx=exact

* delete the remove laters

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Revert "fixing all not-implemented hessian issues (#45)"

This reverts commit f9a0108f56d16f88d0934db8f3f124294e9890e8.

* Raising unimplemented errors (#46)

* fixing all not-implemented hessian issues

* making some tests pass with hessian_approx=exact

* delete the remove laters

* fixing review from daniel

* make change to quadform for real

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* clean up code and fixed bug in log-canon. Checked that all tests in NLP/tests pass (#48)

* smooth approx. and resolve (#47)

* first draft of the smooth approx, without breaking everything

* add passing in original problem for second reduction

* add nlpsolvingchain

* a bit of progress on idea of simplifying the solve chain

* getting smooth approximation to work

* getting smooth approximation and resolve to work

* fixing imports in solvingchain

* fix extra arg in problem_get_data

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* implemented smooth logic for abs and added some lasso tests. All of t… (#51)

* implemented smooth logic for abs and added some lasso tests. All of them pass.

* small changes

* Sparse hess other approach (#53)

* new sparse hessian logic

* entropy focus

* New jacobian (#55)

* new sparse hessian logic

* entropy focus

* new sparse Jacobian structure

* error checking

* some jacobian tests

* adding atom name in error for arguments of jacobian and hessian (#57)

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* special index jacobian (#58)

* Optimal control example and cleaning up sandbox (#59)

* removing lots of examples and starting rocket one

* adding racecar example

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* remove space shuttle example

* fix issue with trig example, remove LS dual initialization (#60)

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Fix jacobian of index (#61)

* refactor all tests so that jac/hess is unpacked in one line

* add tests for matrix expression for elementwise atoms

* getting matrix slice to work

* fix indexing to be general for matrices

* marking certain tests as failing

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Add some control examples and fix canon issues (#64)

* fixing racecar and control of car

* adding refactored example, but issues with hessian of promote

* fixing rocket example

* fixing changes from dance

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* merge cvxpy master to get newest ci changes (#68)

* Fix benchmark link (#2938)

* add feasible as solver states for xpress (#2940)

Co-authored-by: Marc Bataillou Almagro <maalmagr@amazon.com>

* adding MIP warmstart for XPRESS (#2945)

Co-authored-by: Marc Bataillou Almagro <maalmagr@amazon.com>

* Support for cvxpy.convolve into complex2real, fix sparse convolutions in Scipy (#2947)

* Add support for cvxpy.convolve into complex2real

Altough cvxpy.conv is supported, cvxpy.convolve is a different atom
and thus requires to be explicitly specified in order to be supported.

Fixes #2946

* Add a test for complex cp.conv and cp.convolve

* Fix sparse convolution for the Scipy backend

If the lhs operand has zeroes in it, they get consumed by the .tocoo
call. This means that the amount of nonzero elements computed beforehand
is no longer correct, yielding a dimension mismatch a few lines later.

This is a tentative attempt at fixing this, should be carefully analyzed
by someone that can actually read this numpy juggling.

Fixes #2949

* passing original variable names and constraint ids to improve debugging (#2948)

Co-authored-by: Marc Bataillou Almagro <maalmagr@amazon.com>

* Revert "Passing original variable names and constraint ids to improve debugging" (#2950)

* Revert "passing original variable names and constraint ids to improve debuggi…"

This reverts commit 9fb19745838896bf8ecdf76613ba081461808160.

* Revert "patch empty breaking empty rownames for xpress>=9.5 (#2745)"

This reverts commit 6870f5f15d82b309d704a288ad1f72dacb08e1ab.

* Revert "adding MIP warmstart for XPRESS (#2945)"

This reverts commit 9e36b12657d846e9b9821a3b49b64c4ef8dfbf66.

---------

Co-authored-by: William Zijie Zhang <89562186+Transurgeon@users.noreply.github.com>

* Bump pypa/cibuildwheel from 3.1.4 to 3.2.0 (#2952)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 3.1.4 to 3.2.0.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v3.1.4...v3.2.0)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github/codeql-action from 3.30.1 to 3.30.5 (#2953)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.1 to 3.30.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f1f6e5f6af878fb37288ce1c627459e94dbf7d01...3599b3baa15b485a2e49ef411a7a4bb2452e7f93)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.30.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update Python version in devcontainer configuration (#2955)

* Bump ossf/scorecard-action from 2.4.2 to 2.4.3 (#2958)

Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/05b42c624433fc40578a4040d5cf5e36ddca8cde...4eaacf0543bb3f2c246792bd56e8cdeffafb205a)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github/codeql-action from 3.30.5 to 3.30.6 (#2959)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.5 to 3.30.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/3599b3baa15b485a2e49ef411a7a4bb2452e7f93...64d10c13136e1c5bce3e5fbde8d4906eeaafc885)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.30.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build python314 and free-threaded (#2899)

* trying to build py314 and free-threaded

* Tries to use most recent scipy always

* Drops 3.13t since deps require cfft which isn't available

---------

Co-authored-by: Parth Nobel <parthnobel@berkeley.edu>

* consolidate warmstart and varname changes (#2957)

* Add cp.stack atom (#2956)

* Add cp.stack atom

* rebase

* address comments: remove erroneous import, add canonicalization test

* Run tests against editable install

* Enable editable install for OpenMP builds

* Use editable install in backend workflow

* Fix Windows install mode

* Revert Windows-specific pytest args

* excludes build for windows-2022 on python314t (#2960)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Govind Chari <govindchari1@gmail.com>
Co-authored-by: Marc Bataillou Almagro <marc.bataillou@gmail.com>
Co-authored-by: Marc Bataillou Almagro <maalmagr@amazon.com>
Co-authored-by: Josef Gajdusek <atx@atx.name>
Co-authored-by: Parth Nobel <ptnobel@stanford.edu>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nika Zahedi <99093984+Ni2002ka@users.noreply.github.com>
Co-authored-by: Parth Nobel <parthnobel@berkeley.edu>
Co-authored-by: Clay Campaigne <clay.campaigne@gmail.com>

* cleanup CI and try to make it pass (#67)

* add init for nlp_solvers folder

* remove some tests

* add skips for unittests involving nlp

* adding skips using pytest

* revert grad for mulexpression

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* setting up workflow for nlp testing (#69)

* testing nlp workflow

* adding bash -l

* changes name of job to run_nlp_tests

* adds skips for currently failing tests

* and an expected to fail for socp test

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Disciplined nonlinear programming (#70)

* initial draft for dnlp

* added is_esr/hsr for expressions and atoms, and the composition rule

* some fixes for missing esr in leaf and new outline for tests

* adds a few more tests

* adds some very simple compostions

* remove unused imports

* adding more tests

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>
Co-authored-by: Daniel <danielcederberg1@gmail.com>

* initial changes for dnlp2smooth reduction (#71)

* initial changes for dnlp2smooth reduction

* remove unused imports

* add very simple dnlp error for now

* fix some tests which are non-dnlp

* remove special case for multiply vs matmul expressions

* adding changes from dance review

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Fixing two control examples (#74)

* fixing 2 more control examples, finding bug in multiply with sum of indexes

* fix some imports

* add cleaner fix and comment

* push up embarassing typo

* remove clnl beam from sandbox

* remove comments

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* canonicalization changes for p-norm and power (#72)

* adding some initial changes for pnorm and power

* adding jac and hess of quad_over_lin

* fix jacobian and adding another socp test

* update and add a quad_over_lin test

* applying review from dance858

* fix linting

* adding skip for nonlinear control test

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Jacobian of sum of a matrix with index = 0 (or 1) (#75)

* adding some progress on solving the optimal powerflow problem

* remove test for jacobian none index

* removing test for jacobian of none index

* remove group lasso and l1/2-regularization

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* matmul (#76)

* matmul

* removed two lines

* Risk parity new (#77)

* dimension fix scalar

* added risk parity tests

* added large example with factor model

* made power smooth

* updated test to reflect that sqrt is smooth these days

* skip test if ipopt not installed

* change to test

* ML gaussian comment out formulation 1

* ML gaussian comment out formulation 1

* Adds jacobian/hess_vec for reshape and fixes ACOPF example (finally!) (#78)

* fixing opf example that uses reshape

* add some basic tests

* fix linting issues

* changing bounds to constraints

* change delta tolerance to be 1e-6

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Localization (#81)

* localization works

* removing _jacobian from variable

* Moving bounds class to NLP solver (#82)

* initial refactor for nlp solver, moving bounds to nlp solver instead of ipopt

* some more refactoring for the initial point

* some other minor changes

* removing some comments

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* NMF and circle packing (#83)

* NMF and circle packing

* fixed William's comments

* trivial change

* Adds transpose implementation

* Trying master sync (#85)

* Various fixes to help CVXPYlayers (#2951)

* Removes assert that prevents canonicalizing without parameter values

* renames c -> q in the ParamConicProg so it has the same API as ParamQuadProg

* Fixes a bug in the tests

* Fixes a bug

* Fix qoco links (#2963)

* Bump astral-sh/setup-uv from 6 to 7 (#2967)

Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6 to 7.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/v6...v7)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fixes .name() for multiply expressions and HiGHS tests (#2983)

* Fixes .name() for multiply expressions

* Fixes tests lol

* Fixes HiGHS tests

* Bump github/codeql-action from 3.30.6 to 4.31.2 (#2986)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.6 to 4.31.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/64d10c13136e1c5bce3e5fbde8d4906eeaafc885...0499de31b99561a6d14a36a5f662c2a54f91beee)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* adding variable bounds to PDLP (#2974)

* adding variable bounds to pdlp

* add check for none variable bounds

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Fix issue 1222 (#2971)

* dev container + powconeND template

* working on supporting powconeND

* added more support for powconeND

* trying to add support for ND cone

* tested passing generalized power cones to clarabel

* continuing working on nd, new example

* preliminary version, pre-dual handling. Need to check axis

* fixed axis handling, starting tests for general variable orderin

* tested variable switching for powconeND

* fix shape problems for power cone nd dual vars

* fix shape problems for power cone nd dual vars

* found bug in conversion of nd->3d cones

* clean-up changes, removed stale TODOs, more testing

* "cleaning up"

* moved checking for exotic constraints to within each solver loop

* slight logic improvement

* removed stale TODOs and cleaned up code

* fixed powconeND shape property when axis=1

* implemented additional checks in solving_chain, made powconeND tests compatible with cvxpy test set

* improved testing depth and readability

* suggested changes by Steven and William

* added explanation in power.py

* fixed bug causing unnecessary constraints to be added to the problem

* removed redundant axis checks in cone_matrix_stuffing

* Removed stale note in power.py

Removed note about potential 3-tuple return type.

* Extend sum_largest/sum_smallest to support float k and optimize cvar implementation (#2985)

* support float k in sum_largest and sum_smallest

* support float k in lambda_sum_largest and lambda_sum_smallest

* reimplement cvar using sum_largest instead of dotsort

* Enhance atom validation with NumPy and improve error messages (#2976)

* Use NumPy validation in hstack, vstack, concatenate, and sum

Replaces custom validation with NumPy's input validation using mock
arrays. Improves error messages by adding CVXPY context. Adds missing
test_hstack coverage.

This addresses the atoms specifically mentioned in #2613 and improves
error message traceability as requested in #2620. Other atoms may
benefit from similar improvements in future work.

* Refactor per reviewer feedback

- Consolidate validation: validate_arguments() now calls shape_from_args()
- Add cp. prefix to error messages for clarity
- Eliminates code duplication while maintaining error handling

* Update cuopt_conif.py for cuopt 25.10 (#2989)

* Added feasibility example (#2990)

* Added feasibility example + associated test

* Added feasibility example + associated test

* Modified feasibility speedup test to ensure same rng

* Apply suggestions from code review

Co-authored-by: Parth Nobel <parthnobel@berkeley.edu>

---------

Co-authored-by: Parth Nobel <parthnobel@berkeley.edu>

* CI: change copt write test to use pytest skipif (#2993)

* change copt write test to use pytest skipif

* change gurobi as well

* revret changes to sum

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Parth Nobel <ptnobel@stanford.edu>
Co-authored-by: Govind Chari <govindchari1@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: William Zijie Zhang <william@gridmatic.com>
Co-authored-by: Nika Zahedi <99093984+Ni2002ka@users.noreply.github.com>
Co-authored-by: David Pérez Piñeiro <73615370+davidppineiro@users.noreply.github.com>
Co-authored-by: Zak Kraehling <zak@zakkraehling.net>
Co-authored-by: Trevor McKay <tmgithub1@gmail.com>
Co-authored-by: RyuGood0 <54472797+RyuGood0@users.noreply.github.com>
Co-authored-by: Parth Nobel <parthnobel@berkeley.edu>

* adds correct implementation for special index (#87)

* adds correct implementation for special index

* remove unused C slice matrix

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* improvements on the formulation to the car control example (#88)

* improvements on the formulation to the car control example

* add plotting four examples in one plot and saving as pdf

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* move car control to examples (#92)

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* New NLP solver interfaces for COPT and KNITRO (#89)

* adds initial changes for new interfaces

* big refactor for oracles, moving them to nlp solver superclass

* fix pre-commit

* more pre-commit stuff

* add simple test for notimplemented error for now

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Examples (#93)

* path planning example

* portfolio example

* changes

* fixed failing test

* removed plot file

* removed plot file

* Adds Logistic function and fixes transpose (#96)

* Adds matrix test for Jacobian

* Adds hessian tests and fixes impl

* Fixes bug

* Adds logistic NLP support

* Logistic canon

* Fixes Hessian

* Fixes transpose

* Fixes test I think

* [WIP] bug fix in hess_vec of matmul (#98)

* bug fix in hess_vec of matmul

* fixed very subtle bug

* Cleanup log canon and adds geo_mean canon (#94)

* cleanup log to see what happens

* adds cleanup and geomean first implementation

* adds basic test for geo_mean

* add weight geo mean and trying to bounds on log

* adds back lower bound for log canon

* fixing shape issue for t

* try to use expr.w for the weights

* adding second geo mean test

* adds second test that doesn't converge to global optimal

* add better docstring

* remove remove_later

* fix geo mean second test

* adds correct argument to log canon

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Fixes select_idx for duplicate indices (#97)

* Best of (#100)

* sandbox

* best of implementation + running it on circle packing

* added best of test

* test best of

* test best of

* Knitro interface (#101)

* adds knitro interface from vibing

* parametrizing tests for nlp solvers

* updating interfaces tests

* organizing imports

* remove knitro dev tests

* remove some tolerances in tests and options

* cleanup tests to use solver param directly

* also check knitro license for test_interfaces

* adds changes to the dtpye of indices

* parametrize nlp solvers a bit more cleanly

* remove remove laters

* update invert in interface with more info and add skipping for license check for CI

* adds even more strict license check for knitro

* refactoring tests to be like conic solvers, should be fast now

* fix pre-commit complaint

* revert changes to tests

* revert int conversion of inidices

* Revert "revert int conversion of inidices"

This reverts commit 5f776d35a3e3df0ad4b0b3cd85f97aac8276691c.

* adds back derivative test = none for some tests

* cleanup tests, should be final

* verify that knitro runs locally

* fix imports for precommit

* sparse recovery (#102)

* Revise README for DNLP package introduction

Updated README to introduce DNLP and provide installation instructions.

* readme

* readme

Removed license section and some formatting from README.

* update readme with toy example

* [Ready for review] Going through all atoms (#104)

* gone through diff for all atoms except relative entropy

* added jacobian for relative entropy and fixed hess-vec in case of matrix variables

* pass through canonicalizers

* [Ready for review] best-of-improvements and hyperbolic atoms (#106)

* best of improvements

* hyperbolic functions

* more tests (checked manually that ipopt issued no derivative warnings)

* Adds sparsity for powerflow and fix hessian indexing bug (#107)

* adds change for powerflow example

* adds hessian tests for idx

* reformat imports in problem

* remove remove_later.py

* remove pdf that was committed accidently

* fix hess index test

* adds back original formulation

* sum-largest/smallest/huber (#108)

* Update README.md

* trimmed logistic regression (#109)

* adds knitro algorithms as string options (#110)

* canonicalization (#111)

* canonicalization

* added documentation

* fix duplicate index in hessian of indexing (#112)

* [Ready for review] Initialization order (#114)

* initialization

* clean up

* sparse matrix variable fix (thanks William)

* huber comment

* removed assertion

* minor

* fixed to WZZ's comments

* adds chemistry example (#115)

* try to fix missed stuff from master merge

* delete sandbox (#117)

* delete sandbox

* also removes unused requirements file

* rename nlp tests folder

* rename nlp tests folder

* remove end of line

* fix ci setup

* Fix Ipopt link in README installation section

* remove examples for dnlp (#123)

* Uno interface (#119)

* adds first changes for interface

* some more progress on uno interface

* adds unopy to CI workflows

* remove windows tests

* remove unnecessary nlp workflow

* cleanup test_nlp_solvers

* Adds prod and hstack/vstack and fixes an issue with the newest version of NumPy (#120)

* Adds DNLP cp.prod

* Adds hstack/vstack

* Fixes failing tests

* Fixes hallucination

* Addresses Daniel's comments

* Removes unneeded code

* Addresses Daniel's comments

* Fixes constraints in broken test problem

* Fix NaN validation to reject NaN for Parameters while allowing for Variables (#127)

Parameters should raise ValueError when assigned NaN values, but Variables
need to allow NaN for NLP structural Jacobian/Hessian computation. The
previous code allowed NaN for all Leaf types, breaking upstream test
test_nan_in_parameter_raises.

The fix checks self.variables() to distinguish Variables (returns [self])
from Parameters (returns []).

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Adds COPT solver interface (original PR in #126) (#130)

* Add COPT support

* Add copt to pytest

* Fix code style and copt interface

* Fix copt tests

* Restore original test_interfaces.py

The matrix interface tests were accidentally overwritten with NLP solver
tests. This restores the original unit tests for NumPy and SciPy sparse
matrix interfaces.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: wujian <wujian@shanshu.ai>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Implement diag_vec Jacobian for NLP solving (#133)

* Implement diag_vec Jacobian for NLP solving

- 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>

* Handle sparse value initialization for diag variables in NLP

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>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* change nlp_solver Oracles class to use C diffengine (and adds setup for everything) (#131)

* Integrate DNLP diff engine into NLP solver Oracles class

Replace the pure-Python Oracles class with a new implementation that
wraps the C-based C_problem class from dnlp_diff_engine. This provides
automatic differentiation via the compiled C library instead of the
Python-based jacobian/hessian computation.

Key changes:
- Replace Oracles class implementation in nlp_solver.py
- Use lazy import to avoid circular dependency at module load time
- Convert CSR sparse matrices from diff engine to COO format for solvers
- Cache sparsity structures for jacobian and hessian

Currently supported atoms: log, exp, sum, AddExpression, NegExpression,
Promote. Other atoms (multiply, power, matmul, etc.) need to be added
to the diff engine before all NLP tests pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update TODO tracking for diff engine atom status

- Document all newly added Python bindings (power, trig, hyperbolic, matmul)
- Update test status: 2/15 IPOPT tests now pass
- Clarify blocking issues for remaining tests (index, norm, C bugs)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* added converter to multiply

* Optimize Oracles class: remove redundant forward calls and simplify value extraction

- Remove redundant objective_forward/constraint_forward calls from gradient(),
  jacobian(), and hessian() since NLP solvers guarantee call ordering
- Replace matrix densification + zip iteration with direct COO data return
  for jacobian and hessian value extraction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update TODO tracking for diff engine atom status

- Updated implemented atoms list (index, reshape, sqrt, quad_over_lin, rel_entr)
- Updated test results summary with current pass/fail status
- Added known issues section (segfaults, bivariate matmul, rel_entr scalar)
- Added missing atoms by priority

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update TODO tracking: 14/15 test_nlp_solvers tests now passing

- reshape atom now fully implemented with Python binding (commit 81c5a12)
- All 3 circle packing tests now PASS
- test_clnlbeam now PASSES (previously segfaulted)
- Memory issues with many constraints fixed
- Only test_localization still failing (needs broadcast_to)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update TODO with full NLP test suite results

Full nlp_tests results (2025-01-14):
- 259 passed, 20 failed, 64 skipped, 1 xfailed

Remaining failures by missing atom:
- broadcast_to: 5 tests (localization, broadcast, best_of)
- Prod: 9 tests
- MulExpression (bivariate matmul): 5 tests
- rel_entr scalar variants: 1 test

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Clarify MulExpression: matrix @ matrix where both depend on variables

Examples: X @ Y (both Variables), cos(X) @ sin(Y)
Currently supported: A @ f(x) and f(x) @ A where A is constant

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update TODO: Prod atom now implemented (13/14 tests pass)

- Added Prod to implemented atoms list
- Updated test_prod.py results: 13 passing, 1 failing (axis param)
- Updated summary: 267 passed, 12 failed (down from 20)

Remaining failures: broadcast_to (5), Prod axis (1), MulExpression (5), rel_entr scalar (1)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add diff_engine integration layer for CVXPY-to-C expression conversion

- Create cvxpy/reductions/solvers/nlp_solvers/diff_engine/ package
- Move C_problem wrapper and ATOM_CONVERTERS from dnlp-diff-engine
- converters.py: Expression tree conversion from CVXPY atoms to C nodes
- c_problem.py: C_problem class wrapping the C problem struct
- Update nlp_solver.py to import from new location

This separates CVXPY-specific glue code from the pure C autodiff library,
eliminating circular dependencies and preparing dnlp-diff-engine for
standalone PyPI distribution.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix E402 lint errors: combine docstrings

Merge license header and module docstring into single docstring
to avoid "module level import not at top of file" errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* debugging

* super nasty buggit statusgit status

* equivalent treatment of (n, ) as numpy and cvxpy. Very subtle

* multiply

* converters

* relative entropy converter

* clean up oracle jacobian

* cleaned up jacobian oracle a bit

* minor

* cleaned up oracle class

* best of fix and added derivative checker class

* removed hacky logic with many reshapes to handle numpy's weird broadcasting rule. This is now internally done in the diff engine

* removed skipping of tests (fixed with new matmul convention)

* prod converter

* prod with axis one

* matmul

* stress_tests_diff_engine/

* random initial points

* test for sum

* added power flow as a test and started on transpose converter

* cleaned up convert_matmul so we take advantage of sparsity

* added test for sparse matrix vector

* small edit to test

* cleaned up converter of multiply

* clean up quad form converter

* changed name of test

* added derivative checker to all tests

* added hstack in converter and as test

* trace converter

* transpose converter

* test_affine_matrix_atoms.py

* diag_vec converter and tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add diff_engine_core as git submodule

Add DNLP-diff-engine as a git submodule for building the _diffengine
C extension. The submodule includes:
- Pure C library (pyproject.toml removed)
- Apache 2.0 LICENSE
- Module renamed from _core to _diffengine
- diag_vec atom implementation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add diff_engine build infrastructure and CI submodule checkout

- Add _diffengine Extension to setup/extensions.py (optional, only built
  if diff_engine_core submodule is initialized)
- Update setup.py to include diffengine in extensions list
- Update imports from dnlp_diff_engine to _diffengine
- Add submodules: recursive to all CI workflows that build CVXPY:
  - test_nlp_solvers.yml
  - test_optional_solvers.yml
  - test_backends.yml
  - cvxpygen.yml
  - docs.yml
  - gcsopt.yml
  - build.yml

Cherry-picked from submodule-setup branch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Remove submodules: recursive from workflows that don't need NLP

Only keep submodules for workflows that run NLP tests or build wheels:
- build.yml (builds wheels with all features)
- test_backends.yml (runs all tests including NLP)
- test_nlp_solvers.yml (specifically for NLP tests)

Removed from workflows that don't need NLP support:
- cvxpygen.yml (only runs test_cvxpygen.py)
- docs.yml (just builds documentation)
- gcsopt.yml (only runs gcsopt tests)
- test_optional_solvers.yml (only runs conic/QP solver tests)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix PowerApprox support after upstream Power/PowerApprox split

The upstream CVXPY split Power into exact (Power) and approximate
(PowerApprox) subclasses. This broke NLP solving because:

1. dnlp2smooth used `power` (function) as dict key but lookup uses
   `type(expr)` which returns the class (Power or PowerApprox)
2. power_canon.py used `p_rational` which doesn't exist on PowerApprox
3. diff_engine converters used "power" (lowercase) but class name is "Power"

Fixes:
- dnlp2smooth/__init__.py: Import Power and PowerApprox classes,
  register both with power_canon
- power_canon.py: Use `p_used` instead of `p_rational`
- converters.py: Use "Power" and "PowerApprox" as keys

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix Linux build: define _POSIX_C_SOURCE for clock_gettime

The diff_engine_core uses clock_gettime() and struct timespec for
timing, which require _POSIX_C_SOURCE=200809L on Linux when compiling
with -std=c99 (which disables GNU extensions).

The CMakeLists.txt already had this define, but it wasn't being applied
when building through setuptools. Added define_macros to the diffengine
Extension for Linux builds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix p_rational -> p_used and add Approx atom support

1. power.py: Replace all p_rational references with p_used
   - _verify_hess_vec_args, _hess_vec, _verify_jacobian_args, _jacobian
     all used p_rational which doesn't exist; p_used is correct
   - This fixes AttributeError in hess/jacobian tests

2. dnlp2smooth/__init__.py: Add support for Approx atom classes
   - Import GeoMean, GeoMeanApprox (was geo_mean function)
   - Import PnormApprox (was only Pnorm)
   - Register GeoMean, GeoMeanApprox, Pnorm, PnormApprox in
     SMOOTH_CANON_METHODS so they get canonicalized

The upstream split of atoms into exact/approx subclasses changed
type(expr).__name__ which broke the dictionary lookups.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add DIFF_ENGINE_VERSION macro for pip builds

The diff_engine_core uses DIFF_ENGINE_VERSION macro (defined in CMakeLists.txt
for CMake builds). Added -DDIFF_ENGINE_VERSION="0.0.1" to compile args for
setuptools/pip builds.

Cherry-picked from submodule-setup branch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* add debug output test-nlp-solvers

* Thread verbose parameter to C diff engine and remove debug prints

- Add verbose parameter to C_problem and Oracles classes
- Defer Oracles creation from apply() to solve_via_data() so verbose
  flag is available when constructing the C diff engine
- Remove debug print statements from Oracles.__init__
- Remove timing print statements from IPOPT solve_via_data
- Delete obsolete TODO_diff_engine_atoms.md file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix import formatting and update diff_engine_core submodule

- Add blank line between third-party and local imports (pre-commit)
- Update diff_engine_core submodule to version with verbose parameter support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Remove UNO installation from CI to fix Ubuntu stall

UNO solver was causing the Ubuntu CI job to hang for over an hour.
Tests will be automatically skipped when UNO is not installed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Remove debug artifacts from NLP tests

Remove debug print statements from test_nlp_solvers.py and test_matmul.py,
remove commented-out test code, and change verbose=True to verbose=False
in stress tests for cleaner test output.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Daniel <danielcederberg1@gmail.com>

* Add diff_engine_core release workflow and documentation (#139)

* Add diff_engine_core release workflow and documentation

- Add release.yml workflow for automated GitHub releases on tag push
- Add DIFFENGINE_RELEASE.md with release and submodule update procedures
- Bump diff_engine_core version to 0.1.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add quasi-Newton support and relocate Python bindings to DNLP

- Split init_derivatives() into init_jacobian() and init_hessian() in
  C_problem to allow lazy Hessian initialization
- Add use_hessian parameter to Oracles class to skip Hessian setup
  when using quasi-Newton methods (L-BFGS, BFGS, SR1)
- Update IPOPT interface to detect hessian_approximation='limited-memory'
- Update Knitro interface to detect hessopt != 1 (BFGS/SR1/L-BFGS)
- Update COPT and UNO interfaces with explicit use_hessian=True
- Move Python bindings from diff_engine_core/python/ to
  cvxpy/.../diff_engine/_bindings/ for better maintainability
- Update setup/extensions.py to use new bindings location
- Add test_quasi_newton.py with tests for L-BFGS mode

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix line too long in ipopt_nlpif.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update diff_engine_core submodule to v0.1.0

Update to commit ee7fed2 which includes problem_init_jacobian() and
problem_init_hessian() functions needed by the new bindings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update DIFFENGINE_RELEASE.md with current state

Add section documenting current version (v0.1.0) and note that Python
bindings are now maintained in DNLP, not diff_engine_core.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Remove Python _jacobian and _hess_vec oracle methods (#141)

These methods are now provided by the C-based diff_engine_core library.
The NLP solver Oracles class uses c_problem from diff_engine, not the
Python methods on atoms.

Removed from base classes:
- atom.py: jacobian(), hess_vec(), _jacobian(), _hess_vec(),
  _verify_jacobian_args(), _verify_hess_vec_args()
- variable.py: jacobian(), hess_vec()
- constant.py: jacobian(), hess_vec()

Removed from 13 affine atoms, 10 elementwise atoms, and 4 non-elementwise
atoms (pnorm, prod, quad_form, quad_over_lin).

Deleted test files:
- cvxpy/tests/nlp_tests/jacobian_tests/ (10 files)
- cvxpy/tests/nlp_tests/hess_tests/ (10 files)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Update diff_engine_core to v0.1.1 (#142)

Includes:
- Fix Windows build (#41)
- Remove Python bindings (moved to DNLP repository) (#40)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Extract diff engine bindings into standalone SparseDiffPy package (#148)

* Extract diff engine bindings into standalone SparseDiffPy package

Move C bindings (_bindings/) to the new SparseDiffPy package at
SparseDifferentiation/SparseDiffPy and import via
`from sparsediffpy import _sparsediffengine as _diffengine`.
Remove the diff_engine_core submodule and its build configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* make sparsediffpy a dependency

* ci: trigger CI to verify sparsediffpy PyPI install

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* [WIP] Left matmul refactor (#149)

* clarified 0 iteration termination

* add tests

* removed print statements

* trigger CI

---------

Co-authored-by: William Zijie Zhang <william@gridmatic.com>

* Rename ESR/HSR to linearizable_convex/linearizable_concave (#152)

* Rename ESR/HSR to linearizable_convex/linearizable_concave

Spell out opaque acronyms for clarity per PR review feedback:
is_atom_esr → is_atom_linearizable_convex,
is_atom_hsr → is_atom_linearizable_concave,
is_esr → is_linearizable_convex, is_hsr → is_linearizable_concave,
is_smooth → is_linearizable.

Docstrings clarify that "linearizable convex" means the expression is
convex after linearizing all smooth subexpressions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Adopt three-way atom classification: smooth, nonsmooth-convex, nonsmooth-concave

Replace the two-axis is_atom_linearizable_convex/concave overrides across all
atoms with a single method from the paper's three categories: is_atom_smooth,
is_atom_nonsmooth_convex, or is_atom_nonsmooth_concave. The base class derives
the old linearizable methods for backward compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Inline atom-level linearizable checks into expression-level composition rules

Remove the intermediate is_atom_linearizable_convex/concave methods and
_has_dnlp_classification helper, which were only used in the two
expression-level composition rules in atom.py. The three-way classification
(smooth, nonsmooth-convex, nonsmooth-concave) is now used directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Simplify is_atom_smooth docstring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Propagate initial values to reduced variables in CvxAttr2Constr

When CvxAttr2Constr creates reduced variables for dim-reducing attributes
(e.g., diag), the original variable's initial value was not being lowered
and assigned to the reduced variable. This caused NLP solvers to fail with
"Variable has no value" during initial point construction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Handle sparse values when propagating diag variable initials

When a diag variable has its value set as a sparse matrix, extract the
diagonal directly via scipy rather than passing it through np.diag which
does not support sparse inputs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Revert "Handle sparse values when propagating diag variable initials"

This reverts commit e4225656364c0550a34180859a371ff25856bebe.

* Revert "Propagate initial values to reduced variables in CvxAttr2Constr"

This reverts commit d02a758df20ae581a640bb70b09614f10f83f49e.

* fix pnorm nonsmooth convex

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Propagate initial values to reduced variables for diag attribute (#154)

When CvxAttr2Constr creates reduced variables for dimension-reducing
attributes (e.g. diag=True), the initial value was not propagated to
the reduced variable, causing NLP solvers to fail. This mirrors the
existing value propagation already done for parameters.

Also handle sparse diagonal matrices in lower_value() by using
.diagonal() instead of np.diag() which doesn't accept sparse input.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Make is_linearizable_convex/is_linearizable_concave abstract on Expre… (#153)

* Make is_linearizable_convex/is_linearizable_concave abstract on Expression

Enforce implementation in all Expression subclasses by uncommenting
@abc.abstractmethod decorators. Add missing implementations to indicator
(convex, not concave) and PartialProblem (delegates to is_convex/is_concave).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* remove is_smooth from max

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Add differentiation engine section to README

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Move DerivativeChecker from nlp_solver.py to test helper module (#157)

Separates test-only utility from production code by moving it to
cvxpy/tests/nlp_tests/derivative_checker.py and updating all 19
test file imports.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* remove redundant nonsmooth methods, add types and docs (#158)

* Address review comments: remove redundant nonsmooth methods, add types, docs

- Remove is_atom_nonsmooth_convex/is_atom_nonsmooth_concave from base Atom
  class and 10 atom subclasses; use existing is_atom_convex/is_atom_concave
  in DNLP composition rules instead
- Add type annotations and docstrings to NLPsolver, Bounds, and Oracles
  in nlp_solver.py
- Document Variable.sample_bounds with class-level type annotation and
  docstring
- Revert GENERAL_PROJECTION_TOL back to 1e-10 (was loosened for removed
  IPOPT derivative checker)
- Update CLAUDE.md atom classification docs to reflect simplified API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Move sample_bounds docs from #: comments into Variable class docstring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Extract NLP solving logic from problem.py into nlp_solving_chain.py (#156)

* Extract NLP solving logic from problem.py into nlp_solving_chain.py

Move the ~85-line NLP block from Problem._solve() and the two initial
point methods into a dedicated module. This addresses PR review feedback:
- NLP chain building, initial point logic, and solve orchestration now
  live in cvxpy/reductions/solvers/nlp_solving_chain.py
- Use var.get_bounds() instead of var.bounds so sign attributes (nonneg,
  nonpos) are incorporated into bounds automatically
- Initial point helpers are now private module-level functions instead of
  public Problem methods

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update NLP initial point tests to use _set_nlp_initial_point

Tests now import and call the module-level helper directly instead of
the removed Problem.set_NLP_initial_point() method.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove debug print and expand comment in best_of loop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Gate best_of print on verbose flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address PR review comments on nlp_solving_chain extraction

- Add circular import comment in problem.py explaining the deferred import
- Move NLP_SOLVER_VARIANTS from nlp_solving_chain.py to defines.py
- Set BOUNDED_VARIABLES = True on NLPsolver base class and use it in
  _build_nlp_chain (matching the conic solver pattern in solving_chain.py)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* adds changes to test_problem with parametrize

* Revert verbose unpack comment to original single-line version

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* add init files so tests work

* [Ready for review] Integrating the native COO support in SparseDiff (#160)

* uses new coo handling

* added comment

* fix pre-commit

* fix error message if sample bounds are not set (#161)

* Remove conda from CI, use uv + system IPOPT (#162)

* Remove conda from CI, use uv + system IPOPT

Replace conda-based test_nlp_solvers workflow with uv, installing IPOPT
via system packages (apt on Ubuntu, brew on macOS) instead of conda-forge.
Uncomment IPOPT optional dependency in pyproject.toml so uv sync --extra
IPOPT works. Update installation docs in CLAUDE.md and README.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Keep IPOPT extra commented out to avoid --all-extras breakage

The test_optional_solvers workflow uses uv sync --all-extras, which would
try to build cyipopt without system IPOPT installed. Instead, install
cyipopt directly via uv pip in test_nlp_solvers where the system library
is available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove UV_SYSTEM_PYTHON to fix externally-managed env error

uv pip install fails on Ubuntu when UV_SYSTEM_PYTHON=1 because the
system Python is externally managed. Removing it lets uv use its own
venv created by uv sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Install LAPACK and BLAS dev libraries for cyipopt build on Ubuntu

cyipopt links against LAPACK and BLAS which are not installed by default
on Ubuntu runners.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Use uv venv + uv pip install instead of uv sync for NLP workflow

uv sync manages a locked environment that doesn't play well with
uv pip install for additional packages. Switch to uv venv + uv pip
install to manage the environment directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Documentation (#164)

* uses new coo handling

* added comment

* fix pre-commit

* fix error message if sample bounds are not set

* docs for DNLP

* remove whitespace

* split table up into two

* Cache c problem (#167)

* uses new coo handling

* added comment

* fix pre-commit

* fix error message if sample bounds are not set

* docs for DNLP

* remove whitespace

* split table up into two

* cache C problem in best of

* Pre-PR cleanup for DNLP merge into CVXPY master (#169)

- Remove `submodules: recursive` from CI workflows (build, test_nlp_solvers, test_backends)
- Revert `_grad` in affine_atom.py to upstream version
- Remove NaN-allowance block in leaf.py added for NLP structural jacobian
- Update is_dnlp() docstrings to use linearizable terminology
- Add normalize_shape() helper in converters.py, replacing 7 inline occurrences
- Remove unnecessary comment in nlp_solver.py
- Export UNO in cvxpy/__init__.py
- Revert README.md to upstream CVXPY version

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* remove unnecessary point in dom + clean up C_problem + clean up oracle (#168)

* remove unnecessary point in dom + clean up C_problem + clean up oracle

* fix william's comments

* Revert unnecessary whitespace changes and update DNLP docstring terminology (#170)

- Revert whitespace-only changes in huber, abs, ceil, affine_atom, binary_operators
- Revert cosmetic rename and _jacobian_operator addition in index.py
- Revert isnan check in leaf.py back to original error handling
- Restore removed blank line in quad_form.py
- Update DNLP constraint docstrings to use "linearizable convex/concave" terminology

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Address Steven's PR review comments (#171)

- Remove unused `self.broadcast_type` attribute from `broadcast_to.__init__`
  (was previously used for derivative computation, now handled elsewhere)
- Revert CLAUDE.md to upstream master version (DNLP-specific changes were
  broader than intended for the PR)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Update cvxpy/constraints/zero.py

Co-authored-by: Parth Nobel <parthnobel@berkeley.edu>

* Centralize sparsediffpy import into _bindings.py (#174)

* Centralize sparsediffpy import into _bindings.py

Move the duplicated try/except import of sparsediffpy from c_problem.py
and converters.py into a single _bindings.py module.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* cleanup fix

* fix import issue

* fix import for c_problem as well

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* [WIP] Fix PR comments (#173)

* many fixes to PR feedback

* domain tan non-strict inequalities

* div canon raise warning nonneg + document it

* common canonicalizers

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Daniel Cederberg <101940375+dance858@users.noreply.github.com>
Co-authored-by: Daniel <danielcederberg1@gmail.com>
Co-authored-by: Govind Chari <govindchari1@gmail.com>
Co-authored-by: Marc Bataillou Almagro <marc.bataillou@gmail.com>
Co-authored-by: Marc Bataillou Almagro <maalmagr@amazon.com>
Co-authored-by: Josef Gajdusek <atx@atx.name>
Co-authored-by: Parth Nobel <ptnobel@stanford.edu>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nika Zahedi <99093984+Ni2002ka@users.noreply.github.com>
Co-authored-by: Parth Nobel <parthnobel@berkeley.edu>
Co-authored-by: Clay Campaigne <clay.campaigne@gmail.com>
Co-authored-by: David Pérez Piñeiro <73615370+davidppineiro@users.noreply.github.com>
Co-authored-by: Zak Kraehling <zak@zakkraehling.net>
Co-authored-by: Trevor McKay <tmgithub1@gmail.com>
Co-authored-by: RyuGood0 <54472797+RyuGood0@users.noreply.github.com>
Co-authored-by: Stephen Boyd <boyd@stanford.edu>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: wujian <wujian@shanshu.ai>
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.

1 participant