JuliaArrays / JuliaArrays/StaticArrays.jl
Singular matrix inversion doesn't produce an Exception as it does for Matrix
Open
Nobody has claimed this yet.
numerical-robustness
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
julia> A = [0 1; 0 0]
2×2 Array{Int64,2}:
0 1
0 0
julia> inv(A)
ERROR: Base.LinAlg.LAPACKException(1)
Stacktrace:
[1] chklapackerror(::Int64) at ./linalg/lapack.jl:34
[2] trtrs!(::Char, ::Char, ::Char, ::Array{Float64,2}, ::Array{Float64,2}) at ./linalg/lapack.jl:3291
[3] inv at ./linalg/triangular.jl:536 [inlined]
[4] inv(::Array{Int64,2}) at ./linalg/dense.jl:655
julia> A = @SMatrix [0 1; 0 0]
2×2 StaticArrays.SArray{Tuple{2,2},Int64,2,4}:
0 1
0 0
julia> inv(A)
2×2 StaticArrays.SArray{Tuple{2,2},Float64,2,4}:
NaN -Inf
NaN NaN
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue's inv(A) examples for a singular regular matrix and a StaticArrays @SMatrix. Compare the resulting behavior with Matrix inversion and trace the StaticArrays entry point used by inv. Done means singular static matrices produce the expected exception rather than NaN or Inf values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100