@@ -103,75 +103,40 @@ function bb_numentries(B::BlockSkylineSizes)
103103 numentries
104104end
105105
106-
107-
108-
109- function _BandedBlockMatrix end
110-
111-
112- # A block matrix where only the bands are nonzero
113- # isomorphic to BandedMatrix{Matrix{T}}
114- struct BlockSkylineMatrix{T, DATA<: AbstractVector{T} , BS<: BlockSkylineSizes } <: AbstractBlockBandedMatrix{T}
115- data:: DATA
116- block_sizes:: BS
117-
118- global function _BlockSkylineMatrix (data:: DATA , block_sizes:: BS ) where {T,DATA<: AbstractVector{T} , BS<: BlockSkylineSizes }
119- new {T,DATA,BS} (data, block_sizes)
120- end
121- end
122-
123- """
124- BlockBandedMatrix
125-
126- A `BlockBandedMatrix` is a subtype of `BlockMatrix` of `BlockArrays.jl` whose
127- layout of non-zero blocks is banded.
128- """
129- const BlockBandedMatrix{T} = BlockSkylineMatrix{T, Vector{T}, BlockBandedSizes}
130-
131- # Auxiliary outer constructors
132- @inline _BlockBandedMatrix (data:: AbstractVector , bs:: BlockBandedSizes ) =
133- _BlockSkylineMatrix (data, bs)
134-
135- @inline _BlockBandedMatrix (data:: AbstractVector , kr:: AbstractVector{Int} , jr:: AbstractVector{Int} , (l,u):: NTuple{2, Int} ) =
136- _BlockBandedMatrix (data, BlockBandedSizes (kr,jr, l,u))
137-
138- @inline BlockSkylineMatrix {T} (:: UndefInitializer , block_sizes:: BlockSkylineSizes ) where T =
139- _BlockSkylineMatrix (Vector {T} (undef, bb_numentries (block_sizes)), block_sizes)
140-
141- @inline BlockBandedMatrix {T} (:: UndefInitializer , block_sizes:: BlockBandedSizes ) where T =
142- _BlockSkylineMatrix (Vector {T} (undef, bb_numentries (block_sizes)), block_sizes)
143-
144106"""
145107 BlockSkylineMatrix{T,LL,UU}(M::Union{UndefInitializer,UniformScaling,AbstractMatrix},
146108 rows, cols, (l::LL, u::UU))
147109
148110returns a `sum(rows)`×`sum(cols)` block-banded matrix `A` having elements of type `T`,
149- with block-bandwidths `(l,u)` and where `A[Block(K,J)]` is a
111+ with block-bandwidths `(l,u)`, and where `A[Block(K,J)]` is a
150112`Matrix{T}` of size `rows[K]`×`cols[J]`.
151113
152- `(l,u)` may be integers for constant bandwidths or integer vectors of
153- lengths `rows` and `cols`, respectively, for ragged bands.
114+ `(l,u)` may be integers for constant bandwidths, or integer vectors of length
115+ `length(cols)` for ragged bands. In the latter case, `l` and `u` represent the
116+ number of sub and super-block-bands in each column.
154117
155118# Examples
156119
157120```jldoctest
158121julia> using LinearAlgebra, FillArrays
159122
160- julia> BlockSkylineMatrix(I, [2,3, 4], [1,2,3], ([2,0,1],[1 ,1,1]))
161- 3 ×3-blocked 9 ×6 BlockSkylineMatrix{Bool, Vector{Bool}, BlockBandedMatrices.BlockSkylineSizes{Tuple{BlockArrays.BlockedUnitRange{Vector{Int64}}, BlockArrays.BlockedUnitRange{Vector{Int64}}}, Vector{Int64}, Vector{Int64}, BandedMatrices.BandedMatrix{Int64, Matrix{Int64}, Base.OneTo{Int64}}, Vector{Int64}}}:
123+ julia> BlockSkylineMatrix(I, [2,2,2, 4], [1,2,3], ([2,0,1],[0 ,1,1]))
124+ 4 ×3-blocked 10 ×6 BlockSkylineMatrix{Bool, Vector{Bool}, BlockBandedMatrices.BlockSkylineSizes{Tuple{BlockArrays.BlockedUnitRange{Vector{Int64}}, BlockArrays.BlockedUnitRange{Vector{Int64}}}, Vector{Int64}, Vector{Int64}, BandedMatrices.BandedMatrix{Int64, Matrix{Int64}, Base.OneTo{Int64}}, Vector{Int64}}}:
162125 1 │ 0 0 │ ⋅ ⋅ ⋅
163126 0 │ 1 0 │ ⋅ ⋅ ⋅
164127 ───┼────────┼─────────
165128 0 │ 0 1 │ 0 0 0
166129 0 │ 0 0 │ 1 0 0
167- 0 │ 0 0 │ 0 1 0
168130 ───┼────────┼─────────
131+ 0 │ ⋅ ⋅ │ 0 1 0
169132 0 │ ⋅ ⋅ │ 0 0 1
170- 0 │ ⋅ ⋅ │ 0 0 0
171- 0 │ ⋅ ⋅ │ 0 0 0
172- 0 │ ⋅ ⋅ │ 0 0 0
133+ ───┼────────┼─────────
134+ ⋅ │ ⋅ ⋅ │ 0 0 0
135+ ⋅ │ ⋅ ⋅ │ 0 0 0
136+ ⋅ │ ⋅ ⋅ │ 0 0 0
137+ ⋅ │ ⋅ ⋅ │ 0 0 0
173138
174- julia> BlockSkylineMatrix(Ones(9,6), [2,3,4], [1,2,3], ([2,0,1 ],[1 ,1,1]))
139+ julia> BlockSkylineMatrix(Ones(9,6), [2,3,4], [1,2,3], ([2,0,0 ],[0 ,1,1]))
1751403×3-blocked 9×6 BlockSkylineMatrix{Float64, Vector{Float64}, BlockBandedMatrices.BlockSkylineSizes{Tuple{BlockArrays.BlockedUnitRange{Vector{Int64}}, BlockArrays.BlockedUnitRange{Vector{Int64}}}, Vector{Int64}, Vector{Int64}, BandedMatrices.BandedMatrix{Int64, Matrix{Int64}, Base.OneTo{Int64}}, Vector{Int64}}}:
176141 1.0 │ 1.0 1.0 │ ⋅ ⋅ ⋅
177142 1.0 │ 1.0 1.0 │ ⋅ ⋅ ⋅
@@ -188,6 +153,38 @@ julia> BlockSkylineMatrix(Ones(9,6), [2,3,4], [1,2,3], ([2,0,1],[1,1,1]))
188153"""
189154BlockSkylineMatrix
190155
156+ # A block matrix where only the bands are nonzero
157+ # isomorphic to BandedMatrix{Matrix{T}}
158+ struct BlockSkylineMatrix{T, DATA<: AbstractVector{T} , BS<: BlockSkylineSizes } <: AbstractBlockBandedMatrix{T}
159+ data:: DATA
160+ block_sizes:: BS
161+
162+ global function _BlockSkylineMatrix (data:: DATA , block_sizes:: BS ) where {T,DATA<: AbstractVector{T} , BS<: BlockSkylineSizes }
163+ new {T,DATA,BS} (data, block_sizes)
164+ end
165+ end
166+
167+ """
168+ BlockBandedMatrix
169+
170+ A `BlockBandedMatrix` is a subtype of `BlockMatrix` of `BlockArrays.jl` whose
171+ layout of non-zero blocks is banded.
172+ """
173+ const BlockBandedMatrix{T} = BlockSkylineMatrix{T, Vector{T}, BlockBandedSizes}
174+
175+ # Auxiliary outer constructors
176+ @inline _BlockBandedMatrix (data:: AbstractVector , bs:: BlockBandedSizes ) =
177+ _BlockSkylineMatrix (data, bs)
178+
179+ @inline _BlockBandedMatrix (data:: AbstractVector , kr:: AbstractVector{Int} , jr:: AbstractVector{Int} , (l,u):: NTuple{2, Int} ) =
180+ _BlockBandedMatrix (data, BlockBandedSizes (kr,jr, l,u))
181+
182+ @inline BlockSkylineMatrix {T} (:: UndefInitializer , block_sizes:: BlockSkylineSizes ) where T =
183+ _BlockSkylineMatrix (Vector {T} (undef, bb_numentries (block_sizes)), block_sizes)
184+
185+ @inline BlockBandedMatrix {T} (:: UndefInitializer , block_sizes:: BlockBandedSizes ) where T =
186+ _BlockSkylineMatrix (Vector {T} (undef, bb_numentries (block_sizes)), block_sizes)
187+
191188@inline BlockBandedMatrix {T} (:: UndefInitializer , axes:: NTuple{2,AbstractUnitRange{Int}} , lu:: NTuple{2, Int} ) where T =
192189 BlockSkylineMatrix {T} (undef, BlockBandedSizes (axes, lu... ))
193190
0 commit comments