Skip to content

[WIP] Add kron_left bivariate atom#55

Draft
Transurgeon wants to merge 3 commits intomainfrom
add-kron-left
Draft

[WIP] Add kron_left bivariate atom#55
Transurgeon wants to merge 3 commits intomainfrom
add-kron-left

Conversation

@Transurgeon
Copy link
Copy Markdown
Collaborator

Implements kron(C, X) where C is a constant sparse matrix and X is an expression. Includes forward pass, Jacobian, and weighted-sum Hessian with tests for all three.

@Transurgeon Transurgeon marked this pull request as draft March 27, 2026 02:50
Implements Z = kron(C, X) where C is a constant sparse matrix and X is
an expression. Lives in src/atoms/affine/ alongside left_matmul, takes
the same (param_node, u, ...) signature with param_node required to be
NULL for now — the slot is wired into the struct so adding updatable
parameter support later is a local change.

All inner loops iterate only over the nonzeros of C (cached as active
(i, j) tuples at construction), so C = I_m automatically collapses to
O(m * p * q) work with no identity-detection code. Jacobian sparsity is
built in two passes over the same active-tuple skeleton. wsum_hess
inherits the child's sparsity and runs the same index pattern as an
adjoint.

Covered by six tests: forward (generic + identity), Jacobian (vector
and matrix child), and weighted-sum Hessian (variable child + numerical
diff against a composite exp child).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Transurgeon and others added 2 commits April 22, 2026 00:17
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Function names already label each static function; the ASCII bars are
visual noise.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant