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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add MatrixAlgebraKit svd #111

wants to merge 3 commits into from

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 93.91892% with 9 lines in your changes missing coverage. Please review.

Project coverage is 72.17%. Comparing base (a04776b) to head (7840264).

Files with missing lines Patch % Lines
src/blocksparsearrayinterface/getunstoredblock.jl 0.00% 7 Missing ⚠️
src/factorizations/svd.jl 98.58% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #111      +/-   ##
==========================================
- Coverage   75.07%   72.17%   -2.90%     
==========================================
  Files          27       27              
  Lines        1063     1168     +105     
==========================================
+ Hits          798      843      +45     
- Misses        265      325      +60     
Flag Coverage Δ
docs 12.80% <0.00%> (-3.84%) ⬇️

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.

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.

1 participant