Repository navigation
matmul: compute term2 through BA_kron_matrices_* - #167
Merged
Merged
Conversation
term2 = kron(I_n, X) @ J_g only feeds sum_matrices_*, which takes any kind, so it no longer needs BA_dense_kron_matrices_* directly. For n == 1 the dispatcher routes through BA_matrices_* and term2 is permuted_dense. This is the last direct engine use of BA_dense_kron_matrices_*, so the library can make it private. Adds test_jacobian_matmul_exp_X_exp_y, the first chain-rule matmul test with n == 1: checks the Jacobian against finite differences at two points and that term2 is permuted_dense. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bivariate_full_dom/matmul.ccomputedterm2 = kron(I_n, X) @ J_gwithBA_dense_kron_matrices_*.term2only feedssum_matrices_*, which accepts any kind, so it now uses theBA_kron_matrices_*dispatcher (v0.5.1, already pinned). For n == 1 the dispatcher routes throughBA_matrices_*, soterm2is permuted_dense (its CSR view is free); for n > 1 nothing changes.This removes the engine's last direct call to
BA_dense_kron_matrices_*/BA_sparse_kron_matrices_*, so the library can make both private (sparsediff_linalg PR to follow). Merge this before the next pin bump.Test: new
test_jacobian_matmul_exp_X_exp_y, the first chain-rule matmul test with n == 1 (exp(X) @ exp(y), X 2x3, y 3x1). Checks the Jacobian against finite differences at two points and assertsterm2is permuted_dense (flipping that assert makes it fail).305 tests pass (Debug and Release; 304 + 1), library suite passes,
PROFILE_ONLYbuilds, no new warnings.🤖 Generated with Claude Code