Skip to content

Add MatrixAlgebraKit svd #111

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 12 commits into from
May 6, 2025
Merged

Add MatrixAlgebraKit svd #111

merged 12 commits into from
May 6, 2025

Conversation

lkdvos
Copy link
Contributor

@lkdvos lkdvos commented Apr 28, 2025

This PR replaces the previous svd functionality with MatrixAlgebraKit.svd_compact and MatrixAlgebraKit.svd_full.

The main idea is to have a BlockDiagonalAlgorithm wrappertype to dispatch on, which flags that we will assume the input AbstractBlockSparseMatrix is either blockdiagonal or can be permuted to that form.
The main reason I chose this approach is that there really is no dedicated BlockDiagonal functionality, and I wanted to implement the factorizations without having to first fix a bunch of utility functions for that specific type.

There definitely is a bunch of bookkeeping involved with this, especially for the full decomposition combined with the ability of empty rows and columns and rectangular inputs.
I'd say the fishiest part of this PR is the added function for GetUnstoredBlock when Diagonal matrices are involved, but I feel like this is warranted since that is also how LinearAlgebra.jl handles this.

I'm curious to hear what you think about this, I'd suggest trying to figure this out first and getting this merged, and adding the truncation and the other factorizations in follow-up PRs.
The truncation should be somewhat orthogonal to this anyways, and the other factorizations should almost be copies of this one so getting this figured out first seems reasonable.

Also, I deleted the old SVD implementation since I don't think that is a durable approach in the long run.
This does make it a breaking change, which in principle isn't entirely necessary.

@lkdvos lkdvos requested a review from mtfishman April 28, 2025 20:23
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 94.03974% with 9 lines in your changes missing coverage. Please review.

Project coverage is 72.22%. Comparing base (a04776b) to head (ebd0ac0).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/blocksparsearrayinterface/getunstoredblock.jl 0.00% 7 Missing ⚠️
src/factorizations/svd.jl 98.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #111      +/-   ##
==========================================
- Coverage   75.07%   72.22%   -2.85%     
==========================================
  Files          27       27              
  Lines        1063     1170     +107     
==========================================
+ Hits          798      845      +47     
- Misses        265      325      +60     
Flag Coverage Δ
docs 12.78% <0.00%> (-3.86%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mtfishman
Copy link
Member

Besides the last comment I think this is good to go, though it needs formatting.

lkdvos and others added 2 commits May 6, 2025 15:16
@mtfishman
Copy link
Member

Very nice!

@mtfishman mtfishman merged commit 6c92d7c into main May 6, 2025
18 of 19 checks passed
@mtfishman mtfishman deleted the matrixalgebrakit branch May 6, 2025 20:28
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.

2 participants