Skip to content
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

Add needs_square_A trait #400

Merged
merged 4 commits into from
Oct 25, 2023
Merged

Conversation

avik-pal
Copy link
Member

@avik-pal avik-pal commented Oct 24, 2023

Makes the following changes:

  • New needs_square_A trait for solvers
  • For underdetermined systems, we automatically use Pivoted QR similar to Base

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Merging #400 (12c7ed9) into main (a880003) will decrease coverage by 0.58%.
The diff coverage is 58.33%.

@@            Coverage Diff             @@
##             main     #400      +/-   ##
==========================================
- Coverage   68.95%   68.37%   -0.58%     
==========================================
  Files          26       26              
  Lines        1907     1929      +22     
==========================================
+ Hits         1315     1319       +4     
- Misses        592      610      +18     
Files Coverage Δ
src/factorization.jl 74.56% <50.00%> (-0.22%) ⬇️
src/LinearSolve.jl 89.18% <50.00%> (-9.30%) ⬇️
src/default.jl 65.90% <66.66%> (-0.96%) ⬇️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

function for custom algorithms!
"""
needs_square_A(::Nothing) = false # Linear Solve automatically will use a correct alg!
function needs_square_A(alg::SciMLLinearSolveAlgorithm)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the fallback please.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather, the fallback is true. That's a safe fallback, methods can opt-in to supporting non-square, but anything that supports non-square supports square so that's a safe assumption.

DefaultAlgorithmChoice.QRFactorization
if is_underdetermined(A)
# Underdetermined
DefaultAlgorithmChoice.QRFactorizationPivoted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QRFactorization is already pivoted?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see. @YingboMa what do you think of just always defaulting to pivoted QR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, pivoted QR handles degenerate systems too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's quite a bit slower though.

@ChrisRackauckas ChrisRackauckas merged commit 4ee3e1e into SciML:main Oct 25, 2023
10 of 19 checks passed
@avik-pal avik-pal deleted the ap/needs_square_A branch October 25, 2023 13:21
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.

None yet

3 participants