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

SphericalHarmonics with legendre_polys over 30 is creating nan's #1

Open
MrDaubinet opened this issue Jan 31, 2024 · 2 comments
Open

Comments

@MrDaubinet
Copy link

MrDaubinet commented Jan 31, 2024

This is a horrible issue and one that I can add more value to, but attempting to use the SphericalHarmonics encoder with a legendre_polys > 30 results in an NaN. Great work by the way, this stuff is awesome!

@MarcCoru
Copy link
Owner

Hi,

thanks for the issue and the feedback. Interesting. We started to have issues above L=50. Not yet at L=30. It may depend a bit on the float precision of the individual computers.
I also noticed a small error in the analytic YLM calculations (missing brackets see this commit bd4dbe6)
It only affects a constant within the m=0 harmonics. So, it didn't seem have a large detrimental impact on the experiments.

I fixed it today. Can you try again with the fixed constant? Maybe it will help also with higher orders.
Another try could be to ensure that double precision is used. I can imagine that with low precision, some numerical instabilities can happen

@MrDaubinet
Copy link
Author

@MarcCoru thanks for the speedy response. I'll give it a go with the new commit. Worth noting that I've cast everything to a tensor of type float 64 for sanity checking and I was still getting the error. If the issue persists, I'll write up a notebook and share 😄

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