pymc-devs / pymc-devs/pytensor

ENH: Add slogdet rewrite for block diagonal matrices

Open
#1,921 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Description

rewrite_det_blockdiag exists for det but there is no equivalent for slogdet.

since det(block_diag(A, B, ..)) = prod(det(A), det(B), ...), slogdet can
also be computed from the individual sub matrices instead of decomposing
the full block diagonal matrix.

Similar to how rewrite_det_blockdiag is implemented in
https://github.com/pymc-devs/pytensor/blob/main/pytensor/tensor/rewriting/linalg.py#L864

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pytensor/tensor/rewriting/linalg.py at rewrite_det_blockdiag and compare its handling of block diagonal matrices with the slogdet operation. Add the corresponding slogdet rewrite so the result is computed from the individual submatrices rather than decomposing the full block diagonal matrix. Done means slogdet has equivalent block-diagonal optimization coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, performance
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.