-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bidiagonal to Tridiagonal with immutable bands (#55059)
Using `similar` to generate the zero band necessarily allocates a mutable vector, which would lead to an error if the other bands are immutable. This PR changes this to use `zero` instead, which usually produces a vector of the same type. There are occasions where `zero(v)` produces a different type from `v`, so an extra conversion is added to obtain a zero vector of the same type. The following works after this: ```julia julia> using FillArrays, LinearAlgebra julia> n = 4; B = Bidiagonal(Fill(3, n), Fill(2, n-1), :U) 4×4 Bidiagonal{Int64, Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}: 3 2 ⋅ ⋅ ⋅ 3 2 ⋅ ⋅ ⋅ 3 2 ⋅ ⋅ ⋅ 3 julia> Tridiagonal(B) 4×4 Tridiagonal{Int64, Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}: 3 2 ⋅ ⋅ 0 3 2 ⋅ ⋅ 0 3 2 ⋅ ⋅ 0 3 julia> Tridiagonal{Float64}(B) 4×4 Tridiagonal{Float64, Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}}: 3.0 2.0 ⋅ ⋅ 0.0 3.0 2.0 ⋅ ⋅ 0.0 3.0 2.0 ⋅ ⋅ 0.0 3.0 ```
- Loading branch information
Showing
4 changed files
with
27 additions
and
4 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