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

Incorrect 0-dim zeros and ones #1274

Open
jishnub opened this issue Aug 26, 2024 · 0 comments
Open

Incorrect 0-dim zeros and ones #1274

jishnub opened this issue Aug 26, 2024 · 0 comments

Comments

@jishnub
Copy link
Member

jishnub commented Aug 26, 2024

julia> zeros(SMatrix{2,2,ComplexF64,4})
2×2 SMatrix{2, 2, ComplexF64, 4} with indices SOneTo(2)×SOneTo(2):
 0.0+0.0im  0.0+0.0im
 0.0+0.0im  0.0+0.0im

julia> ones(SMatrix{2,2,ComplexF64,4})
2×2 SMatrix{2, 2, ComplexF64, 4} with indices SOneTo(2)×SOneTo(2):
 1.0+0.0im  1.0+0.0im
 1.0+0.0im  1.0+0.0im

These should return a 0-dim Array with the only element being a 2x2 SMatrix. zeros and ones are documented to return an Array, and the number of dimensions provided as arguments should match the dimension of the returned array. In particular, zeros(T) should be consistent with fill(zero(T)):

julia> fill(zero(SMatrix{2,2,ComplexF64,4}))
0-dimensional Array{SMatrix{2, 2, ComplexF64, 4}, 0}:
[0.0 + 0.0im 0.0 + 0.0im; 0.0 + 0.0im 0.0 + 0.0im]
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

1 participant