Skip to content

Static sizing information lost with structured matrices #790

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

Open
sethaxen opened this issue May 17, 2020 · 1 comment
Open

Static sizing information lost with structured matrices #790

sethaxen opened this issue May 17, 2020 · 1 comment

Comments

@sethaxen
Copy link
Contributor

It seems that Base's structured matrices when wrapping static matrices inconsistently propagate that size information to output types of functions on v0.12.3. e.g.

julia> x = @SMatrix randn(3, 3)
3×3 SArray{Tuple{3,3},Float64,2,9} with indices SOneTo(3)×SOneTo(3):
 -1.6129    -0.686314  -1.42919
  0.289051   0.192384   0.170077
  0.877949   0.25176   -0.0438329

julia> s = Symmetric(@SMatrix randn(3, 3))
3×3 Symmetric{Float64,SArray{Tuple{3,3},Float64,2,9}}:
 0.32467   0.193486   0.426171
 0.193486  0.111974   1.33137
 0.426171  1.33137   -0.731089

julia> x * s # size information lost
3×3 Array{Float64,2}:
 -1.26553   -2.2917    -0.55625
  0.203552   0.303905   0.254978
  0.315075   0.139704   0.741387

julia> x + s # size information kept
3×3 SArray{Tuple{3,3},Float64,2,9} with indices SOneTo(3)×SOneTo(3):
 -1.28823   -0.492828  -1.00301
  0.482537   0.304358   1.50145
  1.30412    1.58313   -0.774922
@c42f
Copy link
Member

c42f commented Jun 5, 2020

Yep I guess this is a bug. A reasonable fix would be to upgrade all our linear algebra stuff to dispatch on StaticArrayLike. (There's no way to solve this in a truly generic way without extra support for more sophistocated dispatch in LinearAlgebra.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants