From b78a2acca0eebcaeedd918d588d152733b91fe2a Mon Sep 17 00:00:00 2001 From: dance858 Date: Thu, 26 Mar 2026 16:43:43 -0700 Subject: [PATCH 1/3] reflect sparsediffengine refactor in bindings' --- sparsediffpy/_bindings/atoms/asinh.h | 2 +- sparsediffpy/_bindings/atoms/atanh.h | 2 +- sparsediffpy/_bindings/atoms/common.h | 3 ++- sparsediffpy/_bindings/atoms/cos.h | 2 +- sparsediffpy/_bindings/atoms/entr.h | 2 +- sparsediffpy/_bindings/atoms/logistic.h | 2 +- sparsediffpy/_bindings/atoms/power.h | 2 +- sparsediffpy/_bindings/atoms/sin.h | 2 +- sparsediffpy/_bindings/atoms/sinh.h | 2 +- sparsediffpy/_bindings/atoms/tan.h | 2 +- sparsediffpy/_bindings/atoms/tanh.h | 2 +- sparsediffpy/_bindings/atoms/xexp.h | 2 +- 12 files changed, 13 insertions(+), 12 deletions(-) diff --git a/sparsediffpy/_bindings/atoms/asinh.h b/sparsediffpy/_bindings/atoms/asinh.h index a09934e..09724c8 100644 --- a/sparsediffpy/_bindings/atoms/asinh.h +++ b/sparsediffpy/_bindings/atoms/asinh.h @@ -2,7 +2,7 @@ #define ATOM_ASINH_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" static PyObject *py_make_asinh(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/atanh.h b/sparsediffpy/_bindings/atoms/atanh.h index fd0568d..86519b9 100644 --- a/sparsediffpy/_bindings/atoms/atanh.h +++ b/sparsediffpy/_bindings/atoms/atanh.h @@ -2,7 +2,7 @@ #define ATOM_ATANH_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_restricted_dom.h" static PyObject *py_make_atanh(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/common.h b/sparsediffpy/_bindings/atoms/common.h index 83101dd..72cffdb 100644 --- a/sparsediffpy/_bindings/atoms/common.h +++ b/sparsediffpy/_bindings/atoms/common.h @@ -6,7 +6,8 @@ #include #include "affine.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" +#include "elementwise_restricted_dom.h" #include "expr.h" #define EXPR_CAPSULE_NAME "DNLP_EXPR" diff --git a/sparsediffpy/_bindings/atoms/cos.h b/sparsediffpy/_bindings/atoms/cos.h index 3f798be..152400d 100644 --- a/sparsediffpy/_bindings/atoms/cos.h +++ b/sparsediffpy/_bindings/atoms/cos.h @@ -2,7 +2,7 @@ #define ATOM_COS_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" static PyObject *py_make_cos(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/entr.h b/sparsediffpy/_bindings/atoms/entr.h index 9a37668..899ca00 100644 --- a/sparsediffpy/_bindings/atoms/entr.h +++ b/sparsediffpy/_bindings/atoms/entr.h @@ -2,7 +2,7 @@ #define ATOM_ENTR_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_restricted_dom.h" static PyObject *py_make_entr(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/logistic.h b/sparsediffpy/_bindings/atoms/logistic.h index e903661..86fe1c8 100644 --- a/sparsediffpy/_bindings/atoms/logistic.h +++ b/sparsediffpy/_bindings/atoms/logistic.h @@ -2,7 +2,7 @@ #define ATOM_LOGISTIC_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" static PyObject *py_make_logistic(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/power.h b/sparsediffpy/_bindings/atoms/power.h index da9b7bf..a9fe96b 100644 --- a/sparsediffpy/_bindings/atoms/power.h +++ b/sparsediffpy/_bindings/atoms/power.h @@ -2,7 +2,7 @@ #define ATOM_POWER_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" static PyObject *py_make_power(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/sin.h b/sparsediffpy/_bindings/atoms/sin.h index 426d302..89ca790 100644 --- a/sparsediffpy/_bindings/atoms/sin.h +++ b/sparsediffpy/_bindings/atoms/sin.h @@ -2,7 +2,7 @@ #define ATOM_SIN_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" static PyObject *py_make_sin(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/sinh.h b/sparsediffpy/_bindings/atoms/sinh.h index be86cf5..d3a1abb 100644 --- a/sparsediffpy/_bindings/atoms/sinh.h +++ b/sparsediffpy/_bindings/atoms/sinh.h @@ -2,7 +2,7 @@ #define ATOM_SINH_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" static PyObject *py_make_sinh(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/tan.h b/sparsediffpy/_bindings/atoms/tan.h index 3ec83b7..837128f 100644 --- a/sparsediffpy/_bindings/atoms/tan.h +++ b/sparsediffpy/_bindings/atoms/tan.h @@ -2,7 +2,7 @@ #define ATOM_TAN_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_restricted_dom.h" static PyObject *py_make_tan(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/tanh.h b/sparsediffpy/_bindings/atoms/tanh.h index e60d420..6013173 100644 --- a/sparsediffpy/_bindings/atoms/tanh.h +++ b/sparsediffpy/_bindings/atoms/tanh.h @@ -2,7 +2,7 @@ #define ATOM_TANH_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" static PyObject *py_make_tanh(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/xexp.h b/sparsediffpy/_bindings/atoms/xexp.h index 1dda312..324a9b7 100644 --- a/sparsediffpy/_bindings/atoms/xexp.h +++ b/sparsediffpy/_bindings/atoms/xexp.h @@ -2,7 +2,7 @@ #define ATOM_XEXP_H #include "common.h" -#include "elementwise_univariate.h" +#include "elementwise_full_dom.h" static PyObject *py_make_xexp(PyObject *self, PyObject *args) { From d06c3d61a702bfca6d4f10e16296ae44b34a9638 Mon Sep 17 00:00:00 2001 From: dance858 Date: Tue, 31 Mar 2026 07:07:48 -0700 Subject: [PATCH 2/3] update includes to reflect sparsediffengine structure --- CMakeLists.txt | 3 +++ SparseDiffEngine | 2 +- sparsediffpy/_bindings/atoms/const_scalar_mult.h | 2 +- sparsediffpy/_bindings/atoms/const_vector_mult.h | 2 +- sparsediffpy/_bindings/atoms/dense_matmul.h | 2 +- sparsediffpy/_bindings/atoms/left_matmul.h | 2 +- sparsediffpy/_bindings/atoms/matmul.h | 2 +- sparsediffpy/_bindings/atoms/multiply.h | 2 +- sparsediffpy/_bindings/atoms/prod.h | 2 +- sparsediffpy/_bindings/atoms/prod_axis_one.h | 2 +- sparsediffpy/_bindings/atoms/prod_axis_zero.h | 2 +- sparsediffpy/_bindings/atoms/quad_form.h | 2 +- sparsediffpy/_bindings/atoms/quad_over_lin.h | 2 +- sparsediffpy/_bindings/atoms/rel_entr.h | 2 +- sparsediffpy/_bindings/atoms/rel_entr_scalar_vector.h | 2 +- sparsediffpy/_bindings/atoms/rel_entr_vector_scalar.h | 2 +- sparsediffpy/_bindings/atoms/right_matmul.h | 2 +- sparsediffpy/_bindings/bindings.c | 2 -- 18 files changed, 19 insertions(+), 18 deletions(-) mode change 160000 => 120000 SparseDiffEngine diff --git a/CMakeLists.txt b/CMakeLists.txt index c391e91..c3525ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,9 @@ python3_add_library(_sparsediffengine MODULE target_include_directories(_sparsediffengine PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/SparseDiffEngine/include + ${CMAKE_CURRENT_SOURCE_DIR}/SparseDiffEngine/include/atoms + ${CMAKE_CURRENT_SOURCE_DIR}/SparseDiffEngine/include/utils + ${CMAKE_CURRENT_SOURCE_DIR}/SparseDiffEngine/include/old-code ${CMAKE_CURRENT_SOURCE_DIR}/SparseDiffEngine/src ${CMAKE_CURRENT_SOURCE_DIR}/sparsediffpy/_bindings ) diff --git a/SparseDiffEngine b/SparseDiffEngine deleted file mode 160000 index 7e7875d..0000000 --- a/SparseDiffEngine +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7e7875df92f92b0ef2ecd431d77174768aa22e01 diff --git a/SparseDiffEngine b/SparseDiffEngine new file mode 120000 index 0000000..848f405 --- /dev/null +++ b/SparseDiffEngine @@ -0,0 +1 @@ +../SparseDiffEngine \ No newline at end of file diff --git a/sparsediffpy/_bindings/atoms/const_scalar_mult.h b/sparsediffpy/_bindings/atoms/const_scalar_mult.h index 1a83e5a..121e0c7 100644 --- a/sparsediffpy/_bindings/atoms/const_scalar_mult.h +++ b/sparsediffpy/_bindings/atoms/const_scalar_mult.h @@ -1,7 +1,7 @@ #ifndef ATOM_CONST_SCALAR_MULT_H #define ATOM_CONST_SCALAR_MULT_H -#include "bivariate.h" +#include "bivariate_full_dom.h" #include "common.h" /* Constant scalar multiplication: a * f(x) where a is a constant double */ diff --git a/sparsediffpy/_bindings/atoms/const_vector_mult.h b/sparsediffpy/_bindings/atoms/const_vector_mult.h index aa1f83e..ddb34f7 100644 --- a/sparsediffpy/_bindings/atoms/const_vector_mult.h +++ b/sparsediffpy/_bindings/atoms/const_vector_mult.h @@ -1,7 +1,7 @@ #ifndef ATOM_CONST_VECTOR_MULT_H #define ATOM_CONST_VECTOR_MULT_H -#include "bivariate.h" +#include "bivariate_full_dom.h" #include "common.h" /* Constant vector elementwise multiplication: a ∘ f(x) where a is a constant vector diff --git a/sparsediffpy/_bindings/atoms/dense_matmul.h b/sparsediffpy/_bindings/atoms/dense_matmul.h index d8aef8f..48a8ba9 100644 --- a/sparsediffpy/_bindings/atoms/dense_matmul.h +++ b/sparsediffpy/_bindings/atoms/dense_matmul.h @@ -1,7 +1,7 @@ #ifndef ATOM_DENSE_MATMUL_H #define ATOM_DENSE_MATMUL_H -#include "bivariate.h" +#include "bivariate_full_dom.h" #include "common.h" /* Dense left matrix multiplication: A @ f(x) where A is a dense matrix. diff --git a/sparsediffpy/_bindings/atoms/left_matmul.h b/sparsediffpy/_bindings/atoms/left_matmul.h index 09fa985..1e013c9 100644 --- a/sparsediffpy/_bindings/atoms/left_matmul.h +++ b/sparsediffpy/_bindings/atoms/left_matmul.h @@ -1,7 +1,7 @@ #ifndef ATOM_LEFT_MATMUL_H #define ATOM_LEFT_MATMUL_H -#include "bivariate.h" +#include "bivariate_full_dom.h" #include "common.h" /* Left matrix multiplication: A @ f(x) where A is a constant matrix */ diff --git a/sparsediffpy/_bindings/atoms/matmul.h b/sparsediffpy/_bindings/atoms/matmul.h index 9bfe859..f6f589d 100644 --- a/sparsediffpy/_bindings/atoms/matmul.h +++ b/sparsediffpy/_bindings/atoms/matmul.h @@ -1,7 +1,7 @@ #ifndef ATOM_MATMUL_H #define ATOM_MATMUL_H -#include "bivariate.h" +#include "bivariate_full_dom.h" #include "common.h" /* Matrix multiplication: Z = X @ Y */ diff --git a/sparsediffpy/_bindings/atoms/multiply.h b/sparsediffpy/_bindings/atoms/multiply.h index 5403b38..20db37b 100644 --- a/sparsediffpy/_bindings/atoms/multiply.h +++ b/sparsediffpy/_bindings/atoms/multiply.h @@ -1,7 +1,7 @@ #ifndef ATOM_MULTIPLY_H #define ATOM_MULTIPLY_H -#include "bivariate.h" +#include "bivariate_full_dom.h" #include "common.h" static PyObject *py_make_multiply(PyObject *self, PyObject *args) diff --git a/sparsediffpy/_bindings/atoms/prod.h b/sparsediffpy/_bindings/atoms/prod.h index 9e15818..120d9ba 100644 --- a/sparsediffpy/_bindings/atoms/prod.h +++ b/sparsediffpy/_bindings/atoms/prod.h @@ -3,7 +3,7 @@ #define ATOM_PROD_H #include "common.h" -#include "other.h" +#include "non_elementwise_full_dom.h" static PyObject *py_make_prod(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/prod_axis_one.h b/sparsediffpy/_bindings/atoms/prod_axis_one.h index d9c3b8a..c532f6b 100644 --- a/sparsediffpy/_bindings/atoms/prod_axis_one.h +++ b/sparsediffpy/_bindings/atoms/prod_axis_one.h @@ -2,7 +2,7 @@ #define ATOM_PROD_AXIS_ONE_H #include "common.h" -#include "other.h" +#include "non_elementwise_full_dom.h" static PyObject *py_make_prod_axis_one(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/prod_axis_zero.h b/sparsediffpy/_bindings/atoms/prod_axis_zero.h index 02b30f0..e726076 100644 --- a/sparsediffpy/_bindings/atoms/prod_axis_zero.h +++ b/sparsediffpy/_bindings/atoms/prod_axis_zero.h @@ -3,7 +3,7 @@ #define ATOM_PROD_AXIS_ZERO_H #include "common.h" -#include "other.h" +#include "non_elementwise_full_dom.h" static PyObject *py_make_prod_axis_zero(PyObject *self, PyObject *args) { diff --git a/sparsediffpy/_bindings/atoms/quad_form.h b/sparsediffpy/_bindings/atoms/quad_form.h index 036640a..de7fe89 100644 --- a/sparsediffpy/_bindings/atoms/quad_form.h +++ b/sparsediffpy/_bindings/atoms/quad_form.h @@ -2,7 +2,7 @@ #define ATOM_QUAD_FORM_H #include "common.h" -#include "other.h" +#include "non_elementwise_full_dom.h" /* Quadratic form: y = x' * Q * x where Q is a constant matrix */ static PyObject *py_make_quad_form(PyObject *self, PyObject *args) diff --git a/sparsediffpy/_bindings/atoms/quad_over_lin.h b/sparsediffpy/_bindings/atoms/quad_over_lin.h index d063c8a..a7047e8 100644 --- a/sparsediffpy/_bindings/atoms/quad_over_lin.h +++ b/sparsediffpy/_bindings/atoms/quad_over_lin.h @@ -3,7 +3,7 @@ #ifndef ATOM_QUAD_OVER_LIN_H #define ATOM_QUAD_OVER_LIN_H -#include "bivariate.h" +#include "bivariate_restricted_dom.h" #include "common.h" /* quad_over_lin: y = sum(x^2) / z where x is left, z is right (scalar) */ diff --git a/sparsediffpy/_bindings/atoms/rel_entr.h b/sparsediffpy/_bindings/atoms/rel_entr.h index 1b74318..d7e8cc5 100644 --- a/sparsediffpy/_bindings/atoms/rel_entr.h +++ b/sparsediffpy/_bindings/atoms/rel_entr.h @@ -3,7 +3,7 @@ #ifndef ATOM_REL_ENTR_H #define ATOM_REL_ENTR_H -#include "bivariate.h" +#include "bivariate_restricted_dom.h" #include "common.h" /* rel_entr: rel_entr(x, y) = x * log(x/y) elementwise */ diff --git a/sparsediffpy/_bindings/atoms/rel_entr_scalar_vector.h b/sparsediffpy/_bindings/atoms/rel_entr_scalar_vector.h index 85bcfe7..65d1708 100644 --- a/sparsediffpy/_bindings/atoms/rel_entr_scalar_vector.h +++ b/sparsediffpy/_bindings/atoms/rel_entr_scalar_vector.h @@ -3,7 +3,7 @@ #ifndef ATOM_REL_ENTR_SCALAR_VECTOR_H #define ATOM_REL_ENTR_SCALAR_VECTOR_H -#include "bivariate.h" +#include "bivariate_restricted_dom.h" #include "common.h" /* rel_entr_scalar_vector: rel_entr(x, y) where x is scalar, y is vector */ diff --git a/sparsediffpy/_bindings/atoms/rel_entr_vector_scalar.h b/sparsediffpy/_bindings/atoms/rel_entr_vector_scalar.h index d671646..eb05c15 100644 --- a/sparsediffpy/_bindings/atoms/rel_entr_vector_scalar.h +++ b/sparsediffpy/_bindings/atoms/rel_entr_vector_scalar.h @@ -3,7 +3,7 @@ #ifndef ATOM_REL_ENTR_VECTOR_SCALAR_H #define ATOM_REL_ENTR_VECTOR_SCALAR_H -#include "bivariate.h" +#include "bivariate_restricted_dom.h" #include "common.h" /* rel_entr_vector_scalar: rel_entr(x, y) where x is vector, y is scalar */ diff --git a/sparsediffpy/_bindings/atoms/right_matmul.h b/sparsediffpy/_bindings/atoms/right_matmul.h index f808058..3547837 100644 --- a/sparsediffpy/_bindings/atoms/right_matmul.h +++ b/sparsediffpy/_bindings/atoms/right_matmul.h @@ -1,7 +1,7 @@ #ifndef ATOM_RIGHT_MATMUL_H #define ATOM_RIGHT_MATMUL_H -#include "bivariate.h" +#include "bivariate_full_dom.h" #include "common.h" /* Right matrix multiplication: f(x) @ A where A is a constant matrix */ diff --git a/sparsediffpy/_bindings/bindings.c b/sparsediffpy/_bindings/bindings.c index cbda8e0..e7b30f5 100644 --- a/sparsediffpy/_bindings/bindings.c +++ b/sparsediffpy/_bindings/bindings.c @@ -19,7 +19,6 @@ #include "atoms/hstack.h" #include "atoms/index.h" #include "atoms/left_matmul.h" -#include "atoms/linear.h" #include "atoms/log.h" #include "atoms/logistic.h" #include "atoms/matmul.h" @@ -72,7 +71,6 @@ static int ensure_numpy(void) static PyMethodDef DNLPMethods[] = { {"make_variable", py_make_variable, METH_VARARGS, "Create variable node"}, {"make_constant", py_make_constant, METH_VARARGS, "Create constant node"}, - {"make_linear", py_make_linear, METH_VARARGS, "Create linear op node"}, {"make_log", py_make_log, METH_VARARGS, "Create log node"}, {"make_exp", py_make_exp, METH_VARARGS, "Create exp node"}, {"make_index", py_make_index, METH_VARARGS, "Create index node"}, From 796196c3beaf886a0f40fe3d1a6254f74439ba77 Mon Sep 17 00:00:00 2001 From: dance858 Date: Tue, 31 Mar 2026 07:16:43 -0700 Subject: [PATCH 3/3] bump version to 0.1.6 and update SparseDiffEngine submodule --- SparseDiffEngine | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 120000 => 160000 SparseDiffEngine diff --git a/SparseDiffEngine b/SparseDiffEngine deleted file mode 120000 index 848f405..0000000 --- a/SparseDiffEngine +++ /dev/null @@ -1 +0,0 @@ -../SparseDiffEngine \ No newline at end of file diff --git a/SparseDiffEngine b/SparseDiffEngine new file mode 160000 index 0000000..b9d282f --- /dev/null +++ b/SparseDiffEngine @@ -0,0 +1 @@ +Subproject commit b9d282f04d4347af2420e64a48e00c2c2e5da882 diff --git a/pyproject.toml b/pyproject.toml index bcd5837..9edacec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build" [project] name = "sparsediffpy" -version = "0.1.5" +version = "0.1.6" description = "Python bindings for SparseDiffEngine automatic differentiation" requires-python = ">=3.11" dependencies = ["numpy >= 2.0.0"]