Add slogdet rewrite for block diagonal matrices#1996
Open
YichengYang-Ethan wants to merge 1 commit intopymc-devs:v3from
Open
Add slogdet rewrite for block diagonal matrices#1996YichengYang-Ethan wants to merge 1 commit intopymc-devs:v3from
YichengYang-Ethan wants to merge 1 commit intopymc-devs:v3from
Conversation
Decompose slogdet(block_diag(A, B, ...)) into (prod(sign_i), sum(logabsdet_i)) where each (sign_i, logabsdet_i) = slogdet(A_i). This avoids constructing and factoring the full block diagonal matrix when the slogdet of each block can be computed independently. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
Hi @YichengYang-Ethan , looks like a nice start. It needs a test -- there are many examples in the linalg tests. The important thing is to use |
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.
Summary
rewrite_slogdet_blockdiagthat decomposesslogdet(block_diag(A, B, ...))into(prod(sign_i), sum(logabsdet_i))where each(sign_i, logabsdet_i) = slogdet(A_i).canonicalizeandstabilizephases, matching the pattern used byrewrite_det_blockdiag.Related Issue
Closes #1921
Test plan
test_slogdet_blockdiag_rewriteintests/tensor/rewriting/test_linalg.pyvalidates correctness (sign and logabsdet values) and confirms noBlockDiagonalops remain in the rewritten graph.🤖 Generated with Claude Code