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

Rank selection issue in _compute_svd #88

Closed
loiseaujc opened this issue Apr 29, 2019 · 2 comments
Closed

Rank selection issue in _compute_svd #88

loiseaujc opened this issue Apr 29, 2019 · 2 comments

Comments

@loiseaujc
Copy link
Contributor

loiseaujc commented Apr 29, 2019

Hi guys,

I have noted a small issue with the rank selection in _compute_svd(X, svd_rank) when user prescribes a desired cumulative energy (i.e. a truncation error). Line 242 of dmdbase.py, the code reads

cumulative_energy = np.cumsum(s / s.sum())

However, the energy in POD analysis is related to the square of the singular values, not the singular values themselves. The code should instead read

cumulative_energy = np.cumsum( s**2 / (s**2).sum() )

This is pretty straightforward to modify so should I send a PR or do you guys wanna handle it?

@mtezzele
Copy link
Contributor

You are right, thank you! I will fix this, no problem!

@mtezzele
Copy link
Contributor

Fixed in #89

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

No branches or pull requests

2 participants