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

Improve rand for tangent vectors on SpecialOrthogonal(2) #688

Closed
olivierverdier opened this issue Nov 17, 2023 · 7 comments · Fixed by #689
Closed

Improve rand for tangent vectors on SpecialOrthogonal(2) #688

olivierverdier opened this issue Nov 17, 2023 · 7 comments · Fixed by #689

Comments

@olivierverdier
Copy link
Contributor

olivierverdier commented Nov 17, 2023

If M is defined as [0 1; -1 0], then

SO2 = SpecialOrthogonal(2)
rand(SO2; vector_at=identity_element(SO2)) # always return ±M/sqrt(2)

This contaminates products or semidirect products with SO(2), for instance, tangent vector of SpecialEuclidean(2) are not random either.

@olivierverdier olivierverdier changed the title Random vectors on $SO(2)$ are... not random Random vectors on SpecialOrthogonal(2) are... not random Nov 17, 2023
@olivierverdier
Copy link
Contributor Author

Okay, it's random, so the title is wrong, but it is not normally distributed.

@mateuszbaran
Copy link
Member

Yes, we should change the distribution to something like M .* randn()

@kellertuer kellertuer changed the title Random vectors on SpecialOrthogonal(2) are... not random Improve rand for tangent vectors on SpecialOrthogonal(2) Nov 17, 2023
@kellertuer
Copy link
Member

I think this is really and nice random – rand ( https://docs.julialang.org/en/v1/stdlib/Random/#Base.rand ) does not say, that the randomness might be samples from a finite set.

But you are right, something more normally distributed would be nicer here. but getting distributions (and hence a proper generic rand) to work, cf. #57 is something we have in mind for a really long time, but did not yet have the time to get to.

Here, Mateusz remark should fix this for now at least.

@olivierverdier
Copy link
Contributor Author

I think this is really and nice random – rand ( https://docs.julialang.org/en/v1/stdlib/Random/#Base.rand ) does not say, that the randomness might be samples from a finite set.

I see, that explains it. I should have been warned by the documentation: Usually [...] a Gaussian-like distribution for non-compact manifolds and tangent vectors, although it is not guaranteed.

So random vectors on a circle group returning zero (#686) is also fine, since it samples from a finite set of one element.

I guess the conclusion is that rand on manifolds is not really dependable for now. I'll try to roll out my own random functions instead. You can disregard these issues about random vector generation, then.

@mateuszbaran
Copy link
Member

Well, it should be dependable and return something more reasonable. I will patch both this and CircleGroup.

@kellertuer
Copy link
Member

If you have nice random functions, PRs are very welcome. But there is also a reason that we had the idea to start ManifoldMeasures.jl a few years back – these days maybe again more like ManifoldsDistributions.jl – since that business is nontrivial. And then we (just) need someone to approach such a package.

We can not guarantee much by now, but as Mateusz write, we can surely improve them a bit.
I personally need the rand functions very often just to get some point (not far beyond memory allocation).

@mateuszbaran
Copy link
Member

This should fix both issues: #689

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 a pull request may close this issue.

3 participants