@@ -26,8 +26,6 @@ function bb_blockstarts(axes, l::AbstractVector{Int}, u::AbstractVector{Int})
2626 b_start
2727end
2828
29- bb_blockstarts (b_size, l:: Integer , u:: Integer ) = bb_blockstarts (b_size, Fill (l, nblocks (b_size,2 )), Fill (u, nblocks (b_size,2 )))
30-
3129function bb_blockstrides (b_axes, l:: AbstractVector{Int} , u:: AbstractVector{Int} )
3230 N, M = blocksize .(b_axes,1 )
3331 L,U = maximum (l), maximum (u)
@@ -233,18 +231,12 @@ BlockBandedMatrix(A::Union{AbstractMatrix,UniformScaling},
233231BlockBandedMatrix (A:: AbstractMatrix , lu:: NTuple{2,Int} ) = BlockBandedMatrix (A, BlockBandedSizes (axes (A), lu... ))
234232
235233function convert (:: Type{BlockSkylineMatrix} , A:: AbstractMatrix )
236- @assert isblockbanded (A)
237234 block_sizes = BlockSkylineSizes (axes (A), colblockbandwidths (A)... )
238235
239- ret = BlockSkylineMatrix {eltype(A)} (undef, block_sizes)
240- for J = blockaxes (ret,2 ), K = blockcolsupport (ret, J)
241- view (ret, K, J) .= view (A, K, J)
242- end
243- ret
236+ copyto! (BlockSkylineMatrix {eltype(A)} (undef, block_sizes), A)
244237end
245238
246239function convert (:: Type{BlockBandedMatrix} , A:: AbstractMatrix )
247- @assert isblockbanded (A)
248240 convert (BlockSkylineMatrix, A)
249241end
250242
320312 return v
321313end
322314
323- # # structured matrix methods ##
324- function Base. replace_in_print_matrix (A:: BlockSkylineMatrix , i:: Integer , j:: Integer , s:: AbstractString )
325- bi = findblockindex .(axes (A), (i,j))
326- I,J = Int .(block .(bi))
327- - A. block_sizes. l[J] ≤ J- I ≤ A. block_sizes. u[J] ? s : Base. replace_with_centered_mark (s)
328- end
329-
330315# ###########
331316# Indexing #
332317# ###########
@@ -405,8 +390,8 @@ const BlockBandedBlock{T} = SubArray{T,2,<:BlockSkylineMatrix,<:Tuple{<:BlockSli
405390
406391
407392# gives the columns of parent(V).data that encode the block
408- blocks (V:: BlockBandedBlock ):: Tuple{Int,Int} = first ( first ( parentindices (V)) . block . n),
409- first (last (parentindices (V)). block. n)
393+ _parent_blocks (V:: BlockBandedBlock ):: Tuple{Int,Int} =
394+ first ( first ( parentindices (V)) . block . n), first (last (parentindices (V)). block. n)
410395
411396# #####################################
412397# Matrix interface for Blocks #
@@ -417,16 +402,16 @@ MemoryLayout(::Type{<:BlockBandedBlock}) = ColumnMajor()
417402
418403function Base. unsafe_convert (:: Type{Ptr{T}} , V:: BlockBandedBlock{T} ) where T
419404 A = parent (V)
420- K,J = blocks (V)
405+ K,J = _parent_blocks (V)
421406 Base. unsafe_convert (Ptr{T}, A. data) + sizeof (T)* (blockstart (A,K,J)- 1 )
422407end
423408
424- strides (V:: BlockBandedBlock ) = (1 ,parent (V). block_sizes. block_strides[blocks (V)[2 ]])
409+ strides (V:: BlockBandedBlock ) = (1 ,parent (V). block_sizes. block_strides[_parent_blocks (V)[2 ]])
425410
426411@propagate_inbounds function getindex (V:: BlockBandedBlock , k:: Int , j:: Int )
427412 @boundscheck checkbounds (V, k, j)
428413 A = parent (V)
429- K,J = blocks (V)
414+ K,J = _parent_blocks (V)
430415 if - A. block_sizes. l[J] ≤ J- K ≤ A. block_sizes. u[J]
431416 b_start = blockstart (A,K,J)
432417 b_start == 0 && return zero (eltype (V))
440425@propagate_inbounds function setindex! (V:: BlockBandedBlock , v, k:: Int , j:: Int )
441426 @boundscheck checkbounds (V, k, j)
442427 A = parent (V)
443- K,J = blocks (V)
428+ K,J = _parent_blocks (V)
444429 if - A. block_sizes. l[J] ≤ J- K ≤ A. block_sizes. u[J]
445430 b_start = blockstart (A,K,J)
446431 # TODO : What to do if b_start == 0 ?
0 commit comments