diffcp 0.1.1
- Fix
scsissue with adaptive scaling triggered on R with no long double and also with MKL tolerance. - Fix typo issues pointed out by CRAN.
diffcp 0.1.0
CRAN release: 2026-05-19
First public release of the R port of diffcp.
Features
solve_only(A, b, c, cone_dict, ...)— forward solve of a convex cone program via Clarabel (default) or SCS, supporting all six standard cones (zero, nonneg, SOC, PSD, exponential, exponential dual). Quadratic objectives via thePargument are supported in forward-only mode (mirroring Python diffcp).-
solve_and_derivative(A, b, c, cone_dict, mode, ...)— solves the cone program and returns the optimal(x, y, s)together with two callablesD(dA, db, dc)andDT(dx, dy, ds)that apply the derivative and its adjoint at the supplied perturbations.-
mode = "lsqr"(default): matrix-free LSQR via theMoperator. -
mode = "dense": denseMmatrix factored with Eigen LDLT.
-
pi(x, cones, dual)— projection onto a Cartesian product of cones, withdual = TRUEselecting the dual product cone.PSD-cone forward solves through Clarabel automatically permute the rows of
Aand entries ofbfrom SCS lower-triangular ordering to Clarabel upper-triangular ordering, and permutey/sback on return.
Implementation
The numerical core is a faithful port of the C++ source in cvxgrp/diffcp (
linop.cpp,cones.cpp,deriv.cpp,lsqr.cpp), called from R viaRcppEigen.Each R file is annotated with
## DIFFCP SOURCE: <upstream path>pointing at the corresponding lines in the upstream Python source.
Tests
- 676 tests, faithful ports of every in-scope test in
tests/test_clarabel.py,tests/test_clarabel_psd.py,tests/test_scs.py, andtests/test_cone_prog_diff.pyfrom the upstream Python repository. Test fixtures are pinned to Python diffcp’s outputs at the sameatolbounds Python uses (1e-8on finite-difference D-vs-FD agreement;1e-4on SCS-vs-Clarabel cross-checks;1e-12on round-trips).