Skip to content

Commit bd4f3b0

Browse files
Transurgeonclaude
andcommitted
Inline get_vector helper in const_vector_mult.c
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cf695a2 commit bd4f3b0

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/bivariate/const_vector_mult.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,11 @@
2323

2424
/* Constant vector elementwise multiplication: y = a \circ child */
2525

26-
static inline const double *get_vector(const const_vector_mult_expr *vn)
27-
{
28-
return vn->param_source ? vn->param_source->value : vn->a;
29-
}
30-
3126
static void forward(expr *node, const double *u)
3227
{
3328
expr *child = node->left;
34-
const double *a = get_vector((const_vector_mult_expr *) node);
29+
const_vector_mult_expr *vn = (const_vector_mult_expr *) node;
30+
const double *a = vn->param_source ? vn->param_source->value : vn->a;
3531

3632
/* child's forward pass */
3733
child->forward(child, u);
@@ -59,7 +55,8 @@ static void jacobian_init(expr *node)
5955
static void eval_jacobian(expr *node)
6056
{
6157
expr *x = node->left;
62-
const double *a = get_vector((const_vector_mult_expr *) node);
58+
const_vector_mult_expr *vn = (const_vector_mult_expr *) node;
59+
const double *a = vn->param_source ? vn->param_source->value : vn->a;
6360

6461
/* evaluate x */
6562
x->eval_jacobian(x);
@@ -92,7 +89,8 @@ static void wsum_hess_init(expr *node)
9289
static void eval_wsum_hess(expr *node, const double *w)
9390
{
9491
expr *x = node->left;
95-
const double *a = get_vector((const_vector_mult_expr *) node);
92+
const_vector_mult_expr *vn = (const_vector_mult_expr *) node;
93+
const double *a = vn->param_source ? vn->param_source->value : vn->a;
9694

9795
/* scale weights w by a */
9896
for (int i = 0; i < node->size; i++)

0 commit comments

Comments
 (0)