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

Since v1.0.0 StaticArrays does not calculate vec * vec' correctly #894

Closed
zsoerenm opened this issue Apr 19, 2021 · 2 comments
Closed

Since v1.0.0 StaticArrays does not calculate vec * vec' correctly #894

zsoerenm opened this issue Apr 19, 2021 · 2 comments

Comments

@zsoerenm
Copy link

zsoerenm commented Apr 19, 2021

Before v1.0.0:

julia> Random.seed!(1234)
MersenneTwister(1234)

julia> a = randn(SVector{4, ComplexF64})
4-element SVector{4, ComplexF64} with indices SOneTo(4):
   0.6133070881429037 - 0.6376291670853887im
 -0.34964927975551513 - 0.6384568200223755im
   0.6112240302681179 + 1.564033579102966im
  0.37675588492834183 - 0.19214594122449236im

julia> a * a'
4×4 SMatrix{4, 4, ComplexF64, 16} with indices SOneTo(4)×SOneTo(4):
  0.782717+0.0im          0.192656+0.614517im   -0.622405-1.34897im      0.353585-0.122386im
  0.192656-0.614517im     0.529882+0.0im         -1.21228+0.156623im  -0.00905554-0.307726im
 -0.622405+1.34897im      -1.21228-0.156623im      2.8198+0.0im        -0.0702405+0.706703im
  0.353585+0.122386im  -0.00905554+0.307726im  -0.0702405-0.706703im     0.178865+0.0im

After v1.0.0:

julia> Random.seed!(1234)
MersenneTwister(1234)

julia> a = randn(SVector{4, ComplexF64})
4-element SVector{4, ComplexF64} with indices SOneTo(4):
   0.6133070881429037 - 0.6376291670853887im
 -0.34964927975551513 - 0.6384568200223755im
   0.6112240302681179 + 1.564033579102966im
  0.37675588492834183 - 0.19214594122449236im

julia> a * a'
4×4 SMatrix{4, 4, ComplexF64, 16} with indices SOneTo(4)×SOneTo(4):
 -0.0304254-0.782125im  -0.621541-0.168624im   1.37214+0.569499im   0.108549-0.358075im
  -0.621541-0.168624im  -0.285372+0.446472im  0.784854-0.937103im  -0.254409-0.173359im
    1.37214+0.569499im   0.784854-0.937103im  -2.07261+1.91195im    0.530805+0.471815im
   0.108549-0.358075im  -0.254409-0.173359im  0.530805+0.471815im   0.105025-0.144784im

Before v1.0.0 StaticArrays provided the correct value as can be verified with normal arrays.

@mateuszbaran
Copy link
Collaborator

Sorry, I must have messed something up in #814 . I'll make a patch soon.

mateuszbaran added a commit that referenced this issue Apr 19, 2021
mateuszbaran added a commit that referenced this issue Apr 20, 2021
* fix for issue #894

* bump version
@mateuszbaran
Copy link
Collaborator

Fixed in #895 .

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