Skip to content

Static sizing information lost with structured matrices #790

Open
@sethaxen

Description

@sethaxen

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions