JuliaArrays / JuliaArrays/StaticArrays.jl

Static sizing information lost with structured matrices

Open
#790 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug linear-algebra
Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Julia v0.12.3 using @SMatrix with Symmetric, then compare the output types of multiplication and addition. Trace the relevant StaticArrays methods for these operations and verify that multiplication preserves static size information, with tests covering both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.