Skip to content

Commit f3ff487

Browse files
Transurgeonclaude
andcommitted
Run clang-format over the kron changes
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 824e602 commit f3ff487

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

include/subexpr.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,13 @@ typedef struct convolve_expr
185185
typedef struct kron_expr
186186
{
187187
expr base;
188-
expr *param_source; /* the constant/parameter operand node (re-evaluated each solve) */
188+
expr *param_source; /* the constant/parameter operand node (re-evaluated each
189+
solve) */
189190
int p, q, r, s; /* A is p x q, B is r x s */
190-
int *child_row; /* size_out: child entry each output row gathers; -1 if inactive */
191-
int *coeff_idx; /* size_out: index into param_source->value (valid where child_row >= 0) */
191+
int *child_row; /* size_out: child entry each output row gathers; -1 if inactive
192+
*/
193+
int *coeff_idx; /* size_out: index into param_source->value (valid where
194+
child_row >= 0) */
192195
} kron_expr;
193196

194197
/* Bivariate matrix multiplication: Z = f(u) @ g(u) where both children

src/atoms/affine/kron.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ static void jacobian_init_impl(expr *node)
9191
for (int out = 0; out < node->size; out++)
9292
{
9393
int cr = knode->child_row[out];
94-
if (cr >= 0)
95-
total += Jc->p[cr + 1] - Jc->p[cr];
94+
if (cr >= 0) total += Jc->p[cr + 1] - Jc->p[cr];
9695
}
9796

9897
CSR_matrix *Jk = new_CSR_matrix(node->size, node->n_vars, total);
@@ -130,8 +129,7 @@ static void eval_jacobian(expr *node)
130129
for (int out = 0; out < node->size; out++)
131130
{
132131
int cr = knode->child_row[out];
133-
if (cr < 0)
134-
continue;
132+
if (cr < 0) continue;
135133
double scale = a[knode->coeff_idx[out]];
136134
for (int t = Jc->p[cr]; t < Jc->p[cr + 1]; t++)
137135
{
@@ -164,8 +162,7 @@ static void eval_wsum_hess(expr *node, const double *w)
164162
for (int out = 0; out < node->size; out++)
165163
{
166164
int cr = knode->child_row[out];
167-
if (cr >= 0)
168-
w_prime[cr] += a[knode->coeff_idx[out]] * w[out];
165+
if (cr >= 0) w_prime[cr] += a[knode->coeff_idx[out]] * w[out];
169166
}
170167

171168
child->eval_wsum_hess(child, w_prime);
@@ -192,8 +189,8 @@ static void free_type_data(expr *node)
192189

193190
/* Allocate a kron node and its (all-inactive) index arrays. The left/right
194191
constructors then fill the active rows. */
195-
static kron_expr *new_kron_common(expr *param_node, expr *child, int p, int q,
196-
int r, int s)
192+
static kron_expr *new_kron_common(expr *param_node, expr *child, int p, int q, int r,
193+
int s)
197194
{
198195
int size_out = (p * r) * (q * s);
199196

tests/forward_pass/affine/test_kron.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ const char *test_kron_forward_sparse(void)
9595
double expected[36] = {0};
9696
int pos[12] = {0, 1, 6, 7, 14, 15, 20, 21, 28, 29, 34, 35};
9797
double vals[12] = {1, 3, 2, 4, 1, 3, 2, 4, 1, 3, 2, 4};
98-
for (int t = 0; t < 12; t++)
99-
expected[pos[t]] = vals[t];
98+
for (int t = 0; t < 12; t++) expected[pos[t]] = vals[t];
10099

101100
mu_assert("kron sparse d1=6", Z->d1 == 6);
102101
mu_assert("kron sparse d2=6", Z->d2 == 6);

0 commit comments

Comments
 (0)