Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Diff engine param#147

Open
Transurgeon wants to merge 19 commits intomasterfrom
diff-engine-param
Open

Diff engine param#147
Transurgeon wants to merge 19 commits intomasterfrom
diff-engine-param

Conversation

@Transurgeon
Copy link
Member

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.

Transurgeon and others added 19 commits February 9, 2026 01:27
Add get_param_offsets static method to InverseData and use it in
build_parameter_dict to compute parameter offsets. Register parameter
nodes (parameter, param_scalar_mult, param_vector_mult, left_param_matmul)
with the C problem and support updating parameter values without
rebuilding the expression tree.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Introduces DiffEngineParamConeProg, which replaces the tensor-based
ParamConeProg with a C expression tree that evaluates A, b, q, d (and P
for QPs) via the diff engine's automatic differentiation. Uses the
evaluate-at-zero trick: since all expressions are affine in x after
DCP2Cone, the Jacobian gives A and the gradient gives q directly.

Also adds SymbolicQuadForm and DivExpression converters to the diff
engine, updates ConicSolver/QpSolver to accept the new program type,
and includes comprehensive comparison tests against the SCIPY backend.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Resolve canon_backend=None to DEFAULT_CANON_BACKEND in
construct_solving_chain so that changing the default actually
propagates through all code paths.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
DIFF_ENGINE doesn't yet support all atoms, so keep CPP as default.
The matrix_stuffing benchmarks now use ASV parameterized benchmarks
to compare both backends side-by-side.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
n_params was only used for a size validation check and can be computed
from n_param_nodes + each node's size. This simplifies the API by
removing one argument from problem_register_params and one field to
maintain.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
The dimensions are now read directly from param_node->d1/d2 inside the
C implementation, so the Python binding and caller no longer need to
pass them.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Precompute total parameter size when parameters are registered instead
of recomputing it on every update_params call.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Document why these use generic make_index rather than custom C nodes:
hot-path cost is dominated by Jacobian memcpy, not index lookup, and
the Hessian sparsity limitation is identical either way.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
# Conflicts:
#	CLAUDE.md
#	cvxpy/reductions/solvers/nlp_solvers/diff_engine/_bindings/bindings.c
#	cvxpy/reductions/solvers/solving_chain.py
#	diff_engine_core
The import used `import _diffengine` directly, which isn't available.
Updated to `from sparsediffpy import _sparsediffengine as _diffengine`
to match the rest of the codebase.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Inherit from ParamProb so DiffEngineParamConeProg is no longer a
duck-typed stand-in: move split_solution to the base class, simplify
isinstance checks to use ParamProb, deduplicate format_constraints by
delegating to _build_restruct_operator, and fix PowConeND ndim==1 bug
in the shared operator builder.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
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