Skip to content

Commit b3af8ca

Browse files
committed
ran formatter
1 parent 0d67800 commit b3af8ca

3 files changed

Lines changed: 9 additions & 14 deletions

File tree

include/bivariate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ expr *new_quad_over_lin(expr *left, expr *right);
1010
expr *new_rel_entr_first_arg_scalar(expr *left, expr *right);
1111
expr *new_rel_entr_second_arg_scalar(expr *left, expr *right);
1212

13-
#endif /* BIVARIATE_H */
13+
#endif /* BIVARIATE_H */

src/elementwise_univariate/common.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ void jacobian_init_elementwise(expr *node)
99
if (child->var_id != -1)
1010
{
1111
node->jacobian = new_csr_matrix(node->m, node->n_vars, node->m);
12-
node->jacobian->i[0] = JAC_IDXS_NOT_SET;
12+
for (int j = 0; j < node->m; j++)
13+
{
14+
node->jacobian->p[j] = j;
15+
node->jacobian->i[j] = j + child->var_id;
16+
}
17+
node->jacobian->p[node->m] = node->m;
1318
}
1419
// otherwise it should be a linear operator
1520
else
@@ -26,16 +31,6 @@ void eval_jacobian_elementwise(expr *node)
2631

2732
if (child->var_id != -1)
2833
{
29-
if (node->jacobian->i[0] == JAC_IDXS_NOT_SET)
30-
{
31-
for (int j = 0; j < node->m; j++)
32-
{
33-
node->jacobian->p[j] = j;
34-
node->jacobian->i[j] = j + child->var_id;
35-
}
36-
node->jacobian->p[node->m] = node->m;
37-
}
38-
3934
node->eval_local_jacobian(node, node->jacobian->x);
4035
}
4136
else
@@ -49,4 +44,4 @@ bool is_affine_elementwise(expr *node)
4944
{
5045
(void) node;
5146
return false;
52-
}
47+
}

tests/jacobian_tests/test_rel_entr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ const char *test_jacobian_rel_entr_vector_args_2()
6666
mu_assert("cols fail", cmp_int_array(node->jacobian->i, expected_Ai, 6));
6767
free_expr(node);
6868
return 0;
69-
}
69+
}

0 commit comments

Comments
 (0)