Skip to content

Commit 20655a0

Browse files
Transurgeonclaude
andcommitted
Pass CSR data directly for fixed-const left_matmul, update submodule
- left_matmul.h: replace col-major conversion with direct CSR data pass to new_parameter(nnz, 1, PARAM_FIXED, ...) - Update SparseDiffEngine submodule (CSR data order for params) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4ce7315 commit 20655a0

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

sparsediffpy/_bindings/atoms/left_matmul.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,8 @@ static PyObject *py_make_left_matmul(PyObject *self, PyObject *args)
6565
expr *param_node;
6666
if (param_obj == Py_None)
6767
{
68-
/* Fixed constant: create column-major values for the parameter node */
69-
double *col_major = (double *) calloc(m * n, sizeof(double));
70-
for (int row = 0; row < m; row++)
71-
for (int k = csr_indptr[row]; k < csr_indptr[row + 1]; k++)
72-
col_major[row + csr_indices[k] * m] = csr_data[k];
73-
74-
param_node = new_parameter(m, n, PARAM_FIXED, child->n_vars, col_major);
75-
free(col_major);
68+
/* Fixed constant: pass CSR data directly (values are already in CSR order) */
69+
param_node = new_parameter(nnz, 1, PARAM_FIXED, child->n_vars, csr_data);
7670

7771
if (!param_node)
7872
{

0 commit comments

Comments
 (0)