sparsediff 0.10.0
- The bundled SparseDiffEngine moves from 0.6.1 to 0.10.0, the release that ‘sparsediffpy’ 0.10.x and ‘CVXPY’ 1.9.4 use. Since 0.8.0 the engine keeps its sparse linear algebra in a separate library, ‘sparsediff_linalg’ (0.7.0 here), which is bundled with it.
- Fixed: a parametric problem re-evaluated after
sd_update_params()returned values computed from the old parameter values when the parameter sat undersd_hstack()orsd_vstack()(engine fix #113). For a modeling layer this meant that re-solving such a parametric nonlinear problem after changing a parameter returned the previous solution, reported as optimal. - Fixed: wrong Hessians when one expression node is used by several parents, in
sd_add(),sd_elementwise_mult()andsd_matmul()(engine fixes #159, #169). A shared node is now also evaluated once per pass, not once per parent (#172). - Faster: initializing the derivatives of a problem with many constraints (22 s to 0.3 s for 4000 scalar constraints), and
sd_power()avoidspow()for squares and reciprocals (#171). - New atoms
sd_atan()andsd_atan2(). - New
sd_jacobian_eval(),sd_hessian_eval(),sd_jacobian_csr()andsd_hessian_csr(): evaluate and read the compressed-sparse-row derivatives as separate steps, as in ‘sparsediffpy’ 0.10. Every low-level ‘sparsediffpy’ 0.10.0 function has ansd_*counterpart (?sparsediff). -
sd_log(),sd_entr(),sd_tan()andsd_atanh()now require a variable as their argument, as the engine does since 0.7.0; a composite argument is an error. A modeling layer introduces a variable for it, as ‘CVXPY’ and ‘CVXR’ do. -
sd_prod(),sd_prod_axis_zero()andsd_prod_axis_one()now check that their argument is a variable; the error used to come later, when the derivatives were initialized, without naming the atom. - Fixed:
sd_quad_over_lin()returned wrong derivatives, with no error, when its denominator was a composite expression, a vector, or the numerator itself. The denominator must be a scalar variable different from the numerator, and anything else is now an error.
sparsediff 0.6.1
CRAN release: 2026-10-06
- The bundled SparseDiffEngine moves from 0.3.0 to 0.6.1, the release that ‘sparsediffpy’ 0.6.x and ‘CVXPY’ 1.9.3 use. From this release on, the package version matches the bundled engine version.
- Fixed: a parametric problem re-evaluated after
sd_update_params()could return values computed from the old parameter values (engine fix #107). For a modeling layer this meant that re-solving a parametric nonlinear problem after changing a parameter returned the previous solution, reported as optimal. - Fixed: selecting entries with repeated indices in
sd_index()(for example a quadratic objective over a symmetric variable) could crash R with a bus error when the Jacobian or Hessian was evaluated (engine fix #105). - New
sd_quad_form_dense(): the quadratic form with a dense constant or parametric matrix. The parametric form followssd_update_params().sd_quad_form()keeps its signature and still takes a sparse constant matrix. - Every ‘sparsediffpy’ 0.6.1 function now has an
sd_*counterpart that calls the same engine routine with the same arguments; the name map is on the package help page (?sparsediff). New:sd_left_kron()andsd_right_kron()(Kronecker products, used by the next CVXPY release), the compressed-sparse-row derivative accessorssd_jacobian(),sd_get_jacobian(),sd_init_hessian(),sd_hessian()andsd_get_hessian(), andsd_get_expr_dimensions()/sd_get_expr_size().sd_rel_entr()now dispatches on operand size likemake_rel_entr. - Fixed:
sd_init_hessian_coo()crashed R when called before the Jacobian was initialized; it now initializes the Jacobian first. -
sd_rel_entr(),sd_rel_entr_first_scalar()andsd_rel_entr_second_scalar()now check that their arguments are two different variables, which the engine requires; other arguments overflowed a heap buffer (found with AddressSanitizer). - The BLAS shim gains
cblas_ddot, which the 0.6.1 engine calls. - Fixed: the package failed to compile on Linux systems with glibc 2.36 or older (for example Debian 12), because
_GNU_SOURCEwas defined too late forfopencookie(). It is now set on the compiler command line. - Documentation: the sparse matrix arguments of
sd_quad_form()andsd_left_matmul()/sd_right_matmul()are compressed-sparse-row arrays, and the densedataarguments are row-major. Earlier documentation said compressed-sparse-column and column-major. The grouped help pages now have usage sections (flagged by current R-devel). - The package now has a ‘testthat’ test suite.
