Skip to content

Conversation

dallan-keylogic
Copy link
Contributor

@dallan-keylogic dallan-keylogic commented Feb 11, 2025

Summary/Motivation:

Presently, the SVDToolbox isn't widely utilized, in part because of the limited options for calculating the SVD. Scipy's dense SVD is time-consuming on problems larger than 1000x1000, while its sparse SVD does not work well to find the singular values of the smallest magnitude.

Therefore, I've implemented a custom version of the SVD that is based on Rayleigh-Ritz iteration.

I'd appreciate testers for this method before we merge it.

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Feb 13, 2025
@blnicho blnicho self-requested a review March 27, 2025 18:18
@ksbeattie ksbeattie added Priority:High High Priority Issue or PR and removed Priority:Normal Normal Priority Issue or PR labels Mar 27, 2025
@dallan-keylogic dallan-keylogic marked this pull request as ready for review April 3, 2025 21:35
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 16 lines in your changes missing coverage. Please review.

Project coverage is 77.02%. Comparing base (c84a7fe) to head (21979e2).

Files with missing lines Patch % Lines
idaes/core/util/linalg.py 88.42% 9 Missing and 5 partials ⚠️
idaes/core/util/model_diagnostics.py 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1566      +/-   ##
==========================================
+ Coverage   77.01%   77.02%   +0.01%     
==========================================
  Files         395      396       +1     
  Lines       63555    63683     +128     
  Branches    10365    10390      +25     
==========================================
+ Hits        48944    49053     +109     
- Misses      12171    12185      +14     
- Partials     2440     2445       +5     

☔ 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.

@dallan-keylogic
Copy link
Contributor Author

Pylint is complaining about "Possible unbalanced tuple unpacking". The source of the issue is that the function returns three variables, U, svals, and V, if m=n but it additionally returns a basis for the (left) null space if m!=n. There are multiple ways to make this warning go away, but I want some feedback about the return signature of the function. Should I always return the null space, or only if a specific option is included?

@blnicho
Copy link
Member

blnicho commented Sep 24, 2025

Pylint is complaining about "Possible unbalanced tuple unpacking". The source of the issue is that the function returns three variables, U, svals, and V, if m=n but it additionally returns a basis for the (left) null space if m!=n. There are multiple ways to make this warning go away, but I want some feedback about the return signature of the function. Should I always return the null space, or only if a specific option is included?

My recommendation is to always return the same number of items from the function. We've been burned in the past with APIs that return different numbers of things based on arguments/options passed to the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:High High Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants