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

Possible allocation issue with complex groups? #668

Closed
olivierverdier opened this issue Oct 26, 2023 · 3 comments · Fixed by #677
Closed

Possible allocation issue with complex groups? #668

olivierverdier opened this issue Oct 26, 2023 · 3 comments · Fixed by #677

Comments

@olivierverdier
Copy link
Contributor

olivierverdier commented Oct 26, 2023

Consider a complex group, for instance

G = Unitary(2)

Now, the identity element is a matrix of floats (probably normal so far?)

eltype(identity_element(G)) # Float64

The problem is with allocation (I suppose?).
First, this works well:

eltype(allocate_result(G, typeof(rand))) # ComplexF64

But this doesn't:

eltype(allocate_result(G, typeof(rand), identity_element(G)) # Float64 <-- wrong type?

And, what I would perhaps like best, this doesn't either:

allocate_result(G, typeof(rand), Identity(G)) # BoundsError

Note: I came across this issue by trying to implement a rand! function for complex groups, for testing purposes, and not by playing around with allocate_result, which, I understand, is for internal use.

@mateuszbaran
Copy link
Member

Yes, that's something I need to fix. I will do it when I get a bit of free time.

@mateuszbaran
Copy link
Member

I've prepared a PR with a fix: #677 . allocate_result(G, typeof(rand), Identity(G)) doesn't work but allocate_result(G, typeof(rand)) does. I can make allocate_result(G, typeof(rand), Identity(G)) also work but it's a bit more work.

@olivierverdier
Copy link
Contributor Author

Nice! The Identity one is really not important, you can just ignore it.

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.

2 participants