Skip to content

Added rewrites involving block diagonal matrices #967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 8, 2024

Conversation

tanish1729
Copy link
Contributor

@tanish1729 tanish1729 commented Aug 10, 2024

Description

Added the following rewrites :

  • diag(block_diag(*sub_matrices)) -> concatenate(diag(sub_matrices))
  • det(block_diag(*sub_matrices)) -> prod(det(sub_matrices))
  • slogdet(block_diag(*sub_matrices)) -> prod(sign(a), sign(b), sign(c),...), sum(logdet(a), logdet(b), logdet(c),....)

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

@twiecki
Copy link
Member

twiecki commented Aug 10, 2024

You need to rebase.

@tanish1729 tanish1729 force-pushed the rewrite_diag_blockdiag branch 2 times, most recently from 8b2ef28 to bc30db8 Compare August 16, 2024 18:17
@tanish1729 tanish1729 changed the title Added rewrite for diag(block_diag) Added rewrites for diag(block_diag) and det(block_diag) Aug 16, 2024
@tanish1729 tanish1729 changed the title Added rewrites for diag(block_diag) and det(block_diag) Added rewrites for diag(block_diag), det(block_diag) and slogdet(block_diag) Aug 18, 2024
@tanish1729 tanish1729 changed the title Added rewrites for diag(block_diag), det(block_diag) and slogdet(block_diag) Added rewrites involving block diagonal matrices Aug 19, 2024
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.74%. Comparing base (1a1c62b) to head (fa7d9da).
Report is 133 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #967      +/-   ##
==========================================
+ Coverage   81.73%   81.74%   +0.01%     
==========================================
  Files         182      182              
  Lines       47633    47663      +30     
  Branches    11604    11622      +18     
==========================================
+ Hits        38934    38964      +30     
+ Misses       6509     6507       -2     
- Partials     2190     2192       +2     
Files with missing lines Coverage Δ
pytensor/tensor/rewriting/linalg.py 92.48% <100.00%> (+0.81%) ⬆️

... and 2 files with indirect coverage changes

@tanish1729 tanish1729 force-pushed the rewrite_diag_blockdiag branch from 9857f0f to fa7d9da Compare August 31, 2024 08:20
@jessegrabowski jessegrabowski merged commit 3eea7d0 into pymc-devs:main Oct 8, 2024
60 checks passed
Ch0ronomato pushed a commit to Ch0ronomato/pytensor that referenced this pull request Nov 2, 2024
* added rewrite for diag(block_diag)

* added rewrite for determinant of blockdiag

* Added rewrite for slogdet; added docstrings for all 3 rewrites

* fixed typecasting for tests
@ricardoV94 ricardoV94 added enhancement New feature or request graph rewriting linalg Linear algebra labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request graph rewriting linalg Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants