Skip to content

Commit dc56c90

Browse files
Transurgeonclaude
andcommitted
Run clang-format on parameter support files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 00f7732 commit dc56c90

6 files changed

Lines changed: 22 additions & 22 deletions

File tree

include/bivariate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ expr *new_const_scalar_mult(double a, expr *child);
4242
/* Constant vector elementwise multiplication: a ∘ f(x) where a is constant */
4343
expr *new_const_vector_mult(const double *a, expr *child);
4444

45-
/* Left matrix multiplication with parameter source: P @ f(x) where P is a parameter */
45+
/* Left matrix multiplication with parameter source: P @ f(x) where P is a parameter
46+
*/
4647
expr *new_left_param_matmul(expr *param_node, expr *child);
4748

4849
/* Parameter scalar multiplication: p * f(x) where p is a parameter */

include/problem.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef struct problem
6060
bool jacobian_called;
6161

6262
/* Parameter tracking for fast parameter updates */
63-
expr **param_nodes; /* weak references to parameter nodes in tree */
63+
expr **param_nodes; /* weak references to parameter nodes in tree */
6464
int n_param_nodes;
6565
int total_parameter_size;
6666

@@ -84,8 +84,7 @@ void problem_jacobian(problem *prob);
8484
void problem_hessian(problem *prob, double obj_w, const double *w);
8585

8686
/* Parameter support */
87-
void problem_register_params(problem *prob, expr **param_nodes,
88-
int n_param_nodes);
87+
void problem_register_params(problem *prob, expr **param_nodes, int n_param_nodes);
8988
void problem_update_params(problem *prob, const double *theta);
9089

9190
#endif

include/subexpr.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
/* Forward declaration */
2626
struct int_double_pair;
2727

28-
/* Parameter node: like constant but with updatable values via problem_update_params */
28+
/* Parameter node: like constant but with updatable values via problem_update_params
29+
*/
2930
typedef struct parameter_expr
3031
{
3132
expr base;
@@ -117,8 +118,9 @@ typedef struct left_matmul_expr
117118
CSR_Matrix *A;
118119
CSR_Matrix *AT;
119120
CSC_Matrix *CSC_work;
120-
expr *param_source; /* if non-NULL, refresh A/AT values from param_source->value */
121-
int src_m, src_n; /* original (non-block-diag) matrix dimensions */
121+
expr *
122+
param_source; /* if non-NULL, refresh A/AT values from param_source->value */
123+
int src_m, src_n; /* original (non-block-diag) matrix dimensions */
122124
} left_matmul_expr;
123125

124126
/* Right matrix multiplication: y = f(x) * A where f(x) is an expression.

src/affine/parameter.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
static void forward(expr *node, const double *u)
3030
{
3131
/* Values are set by problem_update_params, not by forward pass */
32-
(void)node;
33-
(void)u;
32+
(void) node;
33+
(void) u;
3434
}
3535

3636
static void jacobian_init(expr *node)
@@ -42,7 +42,7 @@ static void jacobian_init(expr *node)
4242
static void eval_jacobian(expr *node)
4343
{
4444
/* Parameter jacobian never changes */
45-
(void)node;
45+
(void) node;
4646
}
4747

4848
static void wsum_hess_init(expr *node)
@@ -53,19 +53,19 @@ static void wsum_hess_init(expr *node)
5353

5454
static void eval_wsum_hess(expr *node, const double *w)
5555
{
56-
(void)node;
57-
(void)w;
56+
(void) node;
57+
(void) w;
5858
}
5959

6060
static bool is_affine(const expr *node)
6161
{
62-
(void)node;
62+
(void) node;
6363
return true;
6464
}
6565

6666
expr *new_parameter(int d1, int d2, int param_id, int n_vars)
6767
{
68-
parameter_expr *pnode = (parameter_expr *)calloc(1, sizeof(parameter_expr));
68+
parameter_expr *pnode = (parameter_expr *) calloc(1, sizeof(parameter_expr));
6969
init_expr(&pnode->base, d1, d2, n_vars, forward, jacobian_init, eval_jacobian,
7070
is_affine, wsum_hess_init, eval_wsum_hess, NULL);
7171
pnode->param_id = param_id;

src/bivariate/left_matmul.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ static void refresh_param_values(left_matmul_expr *lin_node)
7676
{
7777
memcpy(A->x + block * src_nnz, A->x, src_nnz * sizeof(double));
7878
}
79-
8079
}
8180

8281
static void forward(expr *node, const double *u)
@@ -292,7 +291,8 @@ expr *new_left_param_matmul(expr *param_node, expr *child)
292291
(left_matmul_expr *) calloc(1, sizeof(left_matmul_expr));
293292
expr *node = &lin_node->base;
294293
init_expr(node, d1, d2, child->n_vars, forward, jacobian_init, eval_jacobian,
295-
is_affine, wsum_hess_init, eval_wsum_hess, free_param_matmul_type_data);
294+
is_affine, wsum_hess_init, eval_wsum_hess,
295+
free_param_matmul_type_data);
296296
node->left = child;
297297
expr_retain(child);
298298

src/problem.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,10 @@ void problem_hessian(problem *prob, double obj_w, const double *w)
447447
prob->stats.time_eval_hessian += GET_ELAPSED_SECONDS(timer);
448448
}
449449

450-
void problem_register_params(problem *prob, expr **param_nodes,
451-
int n_param_nodes)
450+
void problem_register_params(problem *prob, expr **param_nodes, int n_param_nodes)
452451
{
453452
prob->n_param_nodes = n_param_nodes;
454-
prob->param_nodes = (expr **)malloc(n_param_nodes * sizeof(expr *));
453+
prob->param_nodes = (expr **) malloc(n_param_nodes * sizeof(expr *));
455454
memcpy(prob->param_nodes, param_nodes, n_param_nodes * sizeof(expr *));
456455

457456
prob->total_parameter_size = 0;
@@ -463,9 +462,8 @@ void problem_update_params(problem *prob, const double *theta)
463462
{
464463
for (int i = 0; i < prob->n_param_nodes; i++)
465464
{
466-
parameter_expr *p = (parameter_expr *)prob->param_nodes[i];
467-
memcpy(p->base.value, theta + p->param_id,
468-
p->base.size * sizeof(double));
465+
parameter_expr *p = (parameter_expr *) prob->param_nodes[i];
466+
memcpy(p->base.value, theta + p->param_id, p->base.size * sizeof(double));
469467
}
470468
/* Force re-evaluation of affine Jacobians on next call */
471469
prob->jacobian_called = false;

0 commit comments

Comments
 (0)