From 71b9a5febf9d4e908b8df45cace8816d45d2cc96 Mon Sep 17 00:00:00 2001 From: dance858 Date: Wed, 15 Apr 2026 09:56:20 -0700 Subject: [PATCH] change order for quad form --- src/atoms/other/quad_form.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/atoms/other/quad_form.c b/src/atoms/other/quad_form.c index 7493758..72474df 100644 --- a/src/atoms/other/quad_form.c +++ b/src/atoms/other/quad_form.c @@ -49,9 +49,6 @@ static void jacobian_init_impl(expr *node) { expr *x = node->left; - /* dwork stores the result of Q @ f(x) in the forward pass */ - node->work->dwork = (double *) SP_MALLOC(x->size * sizeof(double)); - if (x->var_id != NOT_A_VARIABLE) { node->jacobian = new_csr_matrix(1, node->n_vars, x->size); @@ -260,5 +257,8 @@ expr *new_quad_form(expr *left, CSR_Matrix *Q) /* Set type-specific field */ qnode->Q = new_csr_matrix(Q->m, Q->n, Q->nnz); copy_csr_matrix(Q, qnode->Q); + + /* dwork stores the result of Q @ f(x) in the forward pass */ + node->work->dwork = (double *) SP_MALLOC(left->size * sizeof(double)); return node; }