Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SparseDiffEngine
Submodule SparseDiffEngine updated 163 files
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "scikit_build_core.build"
[project]
name = "sparsediffpy"
version = "0.3.0"
description = "Python bindings for SparseDiffEngine automatic differentiation"
description = "Python bindings for SparseDiffEngine algorithmic differentiation"
requires-python = ">=3.11"
dependencies = ["numpy >= 2.0.0"]
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions sparsediffpy/_bindings/atoms/left_matmul.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static PyObject *py_make_left_matmul(PyObject *self, PyObject *args)
}
}

CSR_Matrix *A = new_csr_matrix(m, n, nnz);
CSR_matrix *A = new_CSR_matrix(m, n, nnz);
memcpy(A->x, PyArray_DATA(data_array), nnz * sizeof(double));
memcpy(A->i, PyArray_DATA(indices_array), nnz * sizeof(int));
memcpy(A->p, PyArray_DATA(indptr_array), (m + 1) * sizeof(int));
Expand All @@ -105,7 +105,7 @@ static PyObject *py_make_left_matmul(PyObject *self, PyObject *args)
Py_DECREF(indptr_array);

expr *node = new_left_matmul(param_node, child, A);
free_csr_matrix(A);
free_CSR_matrix(A);

if (!node)
{
Expand Down
6 changes: 3 additions & 3 deletions sparsediffpy/_bindings/atoms/linear.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static PyObject *py_make_linear(PyObject *self, PyObject *args)
}

int nnz = (int) PyArray_SIZE(data_array);
CSR_Matrix *A = new_csr_matrix(m, n, nnz);
CSR_matrix *A = new_CSR_matrix(m, n, nnz);
memcpy(A->x, PyArray_DATA(data_array), nnz * sizeof(double));
memcpy(A->i, PyArray_DATA(indices_array), nnz * sizeof(int));
memcpy(A->p, PyArray_DATA(indptr_array), (m + 1) * sizeof(int));
Expand All @@ -59,7 +59,7 @@ static PyObject *py_make_linear(PyObject *self, PyObject *args)
NPY_ARRAY_IN_ARRAY);
if (!b_array)
{
free_csr_matrix(A);
free_CSR_matrix(A);
return NULL;
}
b_data = (double *) PyArray_DATA(b_array);
Expand All @@ -68,7 +68,7 @@ static PyObject *py_make_linear(PyObject *self, PyObject *args)
expr *node = new_linear(child, A, b_data);

/* Clean up */
free_csr_matrix(A);
free_CSR_matrix(A);
Py_XDECREF(b_array);

if (!node)
Expand Down
4 changes: 2 additions & 2 deletions sparsediffpy/_bindings/atoms/quad_form.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static PyObject *py_make_quad_form(PyObject *self, PyObject *args)
}

int nnz = (int) PyArray_SIZE(data_array);
CSR_Matrix *Q = new_csr_matrix(m, n, nnz);
CSR_matrix *Q = new_CSR_matrix(m, n, nnz);
memcpy(Q->x, PyArray_DATA(data_array), nnz * sizeof(double));
memcpy(Q->i, PyArray_DATA(indices_array), nnz * sizeof(int));
memcpy(Q->p, PyArray_DATA(indptr_array), (m + 1) * sizeof(int));
Expand All @@ -50,7 +50,7 @@ static PyObject *py_make_quad_form(PyObject *self, PyObject *args)
Py_DECREF(indptr_array);

expr *node = new_quad_form(child, Q);
free_csr_matrix(Q);
free_CSR_matrix(Q);

if (!node)
{
Expand Down
4 changes: 2 additions & 2 deletions sparsediffpy/_bindings/atoms/right_matmul.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static PyObject *py_make_right_matmul(PyObject *self, PyObject *args)
}
}

CSR_Matrix *A = new_csr_matrix(m, n, nnz);
CSR_matrix *A = new_CSR_matrix(m, n, nnz);
memcpy(A->x, PyArray_DATA(data_array), nnz * sizeof(double));
memcpy(A->i, PyArray_DATA(indices_array), nnz * sizeof(int));
memcpy(A->p, PyArray_DATA(indptr_array), (m + 1) * sizeof(int));
Expand All @@ -101,7 +101,7 @@ static PyObject *py_make_right_matmul(PyObject *self, PyObject *args)
Py_DECREF(indptr_array);

expr *node = new_right_matmul(param_node, child, A);
free_csr_matrix(A);
free_CSR_matrix(A);

if (!node)
{
Expand Down
10 changes: 5 additions & 5 deletions sparsediffpy/_bindings/problem/hessian.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* total_constraint_size)
*
* Returns:
* Tuple of (data, indices, indptr, (m, n)) for scipy.sparse.csr_matrix
* Tuple of (data, indices, indptr, (m, n)) for scipy.sparse.CSR_matrix
*/
static PyObject *py_problem_hessian(PyObject *self, PyObject *args)
{
Expand Down Expand Up @@ -50,7 +50,7 @@ static PyObject *py_problem_hessian(PyObject *self, PyObject *args)
Py_DECREF(lagrange_arr);

/* Extract CSR components and return as tuple */
CSR_Matrix *H = prob->lagrange_hessian;
CSR_matrix *H = prob->lagrange_hessian;
npy_intp nnz = H->nnz;
npy_intp n_plus_1 = H->n + 1;

Expand Down Expand Up @@ -97,7 +97,7 @@ static PyObject *py_get_hessian(PyObject *self, PyObject *args)
return NULL;
}

CSR_Matrix *H = prob->lagrange_hessian;
CSR_matrix *H = prob->lagrange_hessian;
npy_intp nnz = H->nnz;
npy_intp n_plus_1 = H->n + 1;

Expand Down Expand Up @@ -144,7 +144,7 @@ static PyObject *py_get_problem_hessian_sparsity_coo(PyObject *self, PyObject *a
return NULL;
}

COO_Matrix *coo = prob->lagrange_hessian_coo;
COO_matrix *coo = prob->lagrange_hessian_coo;
npy_intp nnz = coo->nnz;

PyObject *rows = PyArray_SimpleNew(1, &nnz, NPY_INT32);
Expand Down Expand Up @@ -201,7 +201,7 @@ static PyObject *py_problem_eval_hessian_vals_coo(PyObject *self, PyObject *args
refresh_lower_triangular_coo(prob->lagrange_hessian_coo,
prob->lagrange_hessian->x);

COO_Matrix *coo = prob->lagrange_hessian_coo;
COO_matrix *coo = prob->lagrange_hessian_coo;
npy_intp nnz = coo->nnz;

PyObject *data = PyArray_SimpleNew(1, &nnz, NPY_DOUBLE);
Expand Down
8 changes: 4 additions & 4 deletions sparsediffpy/_bindings/problem/jacobian.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static PyObject *py_problem_jacobian(PyObject *self, PyObject *args)

problem_jacobian(prob);

CSR_Matrix *jac = prob->jacobian;
CSR_matrix *jac = prob->jacobian;
npy_intp nnz = jac->nnz;
npy_intp m_plus_1 = jac->m + 1;

Expand Down Expand Up @@ -79,7 +79,7 @@ static PyObject *py_get_jacobian(PyObject *self, PyObject *args)
return NULL;
}

CSR_Matrix *jac = prob->jacobian;
CSR_matrix *jac = prob->jacobian;
npy_intp nnz = jac->nnz;
npy_intp m_plus_1 = jac->m + 1;

Expand Down Expand Up @@ -126,7 +126,7 @@ static PyObject *py_get_jacobian_sparsity_coo(PyObject *self, PyObject *args)
return NULL;
}

COO_Matrix *coo = prob->jacobian_coo;
COO_matrix *coo = prob->jacobian_coo;
npy_intp nnz = coo->nnz;

PyObject *rows = PyArray_SimpleNew(1, &nnz, NPY_INT32);
Expand Down Expand Up @@ -163,7 +163,7 @@ static PyObject *py_problem_eval_jacobian_vals(PyObject *self, PyObject *args)

problem_jacobian(prob);

CSR_Matrix *jac = prob->jacobian;
CSR_matrix *jac = prob->jacobian;
npy_intp nnz = jac->nnz;

PyObject *data = PyArray_SimpleNew(1, &nnz, NPY_DOUBLE);
Expand Down
Loading