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

Fix bug 1218 #1236

Merged
merged 7 commits into from
Apr 30, 2023
Merged

Fix bug 1218 #1236

merged 7 commits into from
Apr 30, 2023

Conversation

vasilNnikolov
Copy link
Contributor

@vasilNnikolov vasilNnikolov commented Apr 24, 2023

A proposed fix to bug 1218. The bug was a typical case of Catastrophic cancellation, where the variance was computed as $E[X^2] - E[X]^2$ and not as $E[(X-E[X])^2]$. The bug is fixed now, the only downside I see is the usage of two folds over the array, one of which is for computation of the mean of the matrix entries $E[X]$. Looking forward to any feedback.

@wisp3rwind
Copy link
Contributor

Wouldn't it be better to implement something like Welford's algorithm?

@@ -111,6 +111,7 @@ serde_json = "1.0"
rand_xorshift = "0.3"
rand_isaac = "0.3"
criterion = { version = "0.4", features = ["html_reports"] }
nalgebra = { path = ".", features = ["debug", "compare", "rand", "macros"]}
Copy link
Member

Choose a reason for hiding this comment

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

That’s an interesting trick!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Did it because rust-analyzer was giving errors whenever I opened the tests folder, since it only parses the code reachable with the default features

@sebcrozet sebcrozet merged commit 1a271ac into dimforge:dev Apr 30, 2023
12 checks passed
@sebcrozet
Copy link
Member

Thanks!

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