forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't read destination indices when copying structured matrices (Juli…
…aLang#55322) Fixes the following regression introduced in v1.11 ```julia julia> using LinearAlgebra julia> D = Diagonal(rand(4)); julia> T = Tridiagonal(Vector{BigFloat}(undef, 3), Vector{BigFloat}(undef, 4), Vector{BigFloat}(undef, 3)) 4×4 Tridiagonal{BigFloat, Vector{BigFloat}}: #undef #undef ⋅ ⋅ #undef #undef #undef ⋅ ⋅ #undef #undef #undef ⋅ ⋅ #undef #undef julia> copyto!(T, D) ERROR: UndefRefError: access to undefined reference Stacktrace: [1] getindex @ ./essentials.jl:907 [inlined] [2] _broadcast_getindex @ ./broadcast.jl:644 [inlined] [3] _getindex @ ./broadcast.jl:675 [inlined] [4] _broadcast_getindex @ ./broadcast.jl:650 [inlined] [5] getindex @ ./broadcast.jl:610 [inlined] [6] macro expansion @ ./broadcast.jl:973 [inlined] [7] macro expansion @ ./simdloop.jl:77 [inlined] [8] copyto! @ ./broadcast.jl:972 [inlined] [9] copyto! @ ./broadcast.jl:925 [inlined] [10] materialize! @ ./broadcast.jl:883 [inlined] [11] materialize! @ ./broadcast.jl:880 [inlined] [12] _copyto_banded!(T::Tridiagonal{BigFloat, Vector{BigFloat}}, D::Diagonal{Float64, Vector{Float64}}) @ LinearAlgebra ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/LinearAlgebra/src/special.jl:323 [13] copyto!(dest::Tridiagonal{BigFloat, Vector{BigFloat}}, src::Diagonal{Float64, Vector{Float64}}) @ LinearAlgebra ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/LinearAlgebra/src/special.jl:315 [14] top-level scope @ REPL[4]:1 ``` After this PR ```julia julia> copyto!(T, D) 4×4 Tridiagonal{BigFloat, Vector{BigFloat}}: 0.909968 0.0 ⋅ ⋅ 0.0 0.193341 0.0 ⋅ ⋅ 0.0 0.194794 0.0 ⋅ ⋅ 0.0 0.506905 ``` The current implementation used an optimization that may not be applicable for non-isbits types, and this PR ensures that we always read from the source and write to the destination.
- Loading branch information
Showing
5 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters