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

Fix _solve with nonisbits type #1071

Merged
merged 4 commits into from
Aug 14, 2022

Conversation

hyrodium
Copy link
Collaborator

@hyrodium hyrodium commented Aug 8, 2022

This PR fixes #1069.

Before this PR

julia> using StaticArrays

julia> M = @SMatrix rand(BigFloat,3,3)
3×3 SMatrix{3, 3, BigFloat, 9} with indices SOneTo(3)×SOneTo(3):
 0.885899  0.31444   0.303044
 0.389052  0.150019  0.169436
 0.6045    0.835933  0.661603

julia> M/M
ERROR: setindex!() with non-isbitstype eltype is not supported by StaticArrays. Consider using SizedArray.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] setindex!
    @ ~/.julia/dev/StaticArrays/src/MArray.jl:39 [inlined]
  [3] macro expansion
    @ ~/.julia/dev/StaticArrays/src/indexing.jl:66 [inlined]
  [4] _setindex!_scalar
    @ ~/.julia/dev/StaticArrays/src/indexing.jl:46 [inlined]
  [5] setindex!
    @ ~/.julia/dev/StaticArrays/src/indexing.jl:42 [inlined]
  [6] macro expansion
    @ ~/.julia/dev/StaticArrays/src/indexing.jl:357 [inlined]
  [7] _setindex!
    @ ~/.julia/dev/StaticArrays/src/indexing.jl:320 [inlined]
  [8] setindex!
    @ ~/.julia/dev/StaticArrays/src/indexing.jl:274 [inlined]
  [9] _solve
    @ ~/.julia/dev/StaticArrays/src/solve.jl:36 [inlined]
 [10] \
    @ ~/.julia/dev/StaticArrays/src/solve.jl:1 [inlined]
 [11] /(A::SMatrix{3, 3, BigFloat, 9}, B::SMatrix{3, 3, BigFloat, 9})
    @ LinearAlgebra ~/julia/julia-1.7.3/share/julia/stdlib/v1.7/LinearAlgebra/src/generic.jl:1152
 [12] top-level scope
    @ REPL[3]:1

After this PR

julia> using StaticArrays

julia> M = @SMatrix rand(BigFloat,3,3)
3×3 SMatrix{3, 3, BigFloat, 9} with indices SOneTo(3)×SOneTo(3):
 0.942716  0.114509  0.0781129
 0.904454  0.745812  0.0366264
 0.101574  0.791193  0.193288

julia> M/M
3×3 SMatrix{3, 3, BigFloat, 9} with indices SOneTo(3)×SOneTo(3):
 1.0  -4.34983e-78  4.93776e-78
 0.0   1.0          0.0
 0.0   0.0          1.0

Comment on lines +34 to +35
if isbitstype(T)
# This if block can be removed when https://github.com/JuliaArrays/StaticArrays.jl/pull/749 is merged.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x-ref :#749
If the PR is resolved, we might not need this PR #1071.

@hyrodium
Copy link
Collaborator Author

I think we can merge this PR since merging #749 might take time and this PR just fixes the issue.

@hyrodium hyrodium merged commit f9c10d2 into JuliaArrays:master Aug 14, 2022
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

Successfully merging this pull request may close these issues.

Matrix division for SMatrix{m, n, BigFloat}
2 participants