Skip to content

Commit d93d7ad

Browse files
committed
More converts for BlockSkyline
1 parent dbb1e50 commit d93d7ad

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/BlockSkylineMatrix.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ end
224224

225225
BlockBandedMatrix{T}(A::AbstractMatrix, block_sizes::BlockBandedSizes) where T =
226226
BlockSkylineMatrix{T}(A, block_sizes)
227+
227228

228229
##
229230
# Special cases
@@ -343,19 +344,21 @@ julia> BlockBandedMatrix(B, (1,1))
343344
"""
344345
BlockBandedMatrix(A::AbstractMatrix, lu::NTuple{2,Int}) = BlockBandedMatrix(A, BlockBandedSizes(axes(A), lu...))
345346

346-
function convert(::Type{BlockSkylineMatrix}, A::AbstractMatrix)
347+
function convert(::Type{BlockSkylineMatrix{T}}, A::AbstractMatrix) where T
347348
block_sizes = BlockSkylineSizes(axes(A), colblockbandwidths(A)...)
348-
349-
copyto!(BlockSkylineMatrix{eltype(A)}(undef, block_sizes), A)
349+
copyto!(BlockSkylineMatrix{T}(undef, block_sizes), A)
350350
end
351351

352-
function convert(::Type{BlockBandedMatrix}, A::AbstractMatrix)
353-
convert(BlockSkylineMatrix, A)
354-
end
352+
convert(::Type{BlockSkylineMatrix}, A::AbstractMatrix) = convert(BlockSkylineMatrix{eltype(A)}, A)
353+
354+
convert(::Type{BlockBandedMatrix}, A::AbstractMatrix) = convert(BlockSkylineMatrix, A)
355+
convert(::Type{BlockBandedMatrix{T}}, A::AbstractMatrix) where T = convert(BlockSkylineMatrix{T}, A)
356+
355357

356358

357359
BlockSkylineMatrix(A::AbstractMatrix) = convert(BlockSkylineMatrix, A)
358360
BlockBandedMatrix(A::AbstractMatrix) = convert(BlockBandedMatrix, A)
361+
BlockBandedMatrix{T}(A::AbstractMatrix) where T = convert(BlockBandedMatrix{T}, A)
359362

360363
similar(A::BlockSkylineMatrix, T::Type=eltype(A), bs::BlockSkylineSizes=A.block_sizes) =
361364
BlockSkylineMatrix{T}(undef, bs)

0 commit comments

Comments
 (0)