Skip to content

Commit d334743

Browse files
authored
BandedBlockBandedMatrix function barrier (#376)
* Disable empty vector in findmindomain/findmaxrange * Function barrier in BandedBlockBandedMatrix
1 parent d8c68be commit d334743

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/Operators/SubOperator.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,23 +263,25 @@ function BandedBlockBandedMatrix(::Type{Zeros}, S::SubOperator)
263263
rows,cols, (l,u), (λ-jsh,μ+ksh))
264264
end
265265

266-
function BandedBlockBandedMatrix(::Type{Zeros}, S::SubOperator{<:Any,<:Any,Tuple{BlockRange1,BlockRange1}})
267-
KR,JR = parentindices(S)
268-
KO = parent(S)
269-
l,u = blockbandwidths(KO)::Tuple{Int,Int}
270-
λ,μ = subblockbandwidths(KO)::Tuple{Int,Int}
271-
272-
rt = rangespace(KO)
273-
dt = domainspace(KO)
266+
function _BandedBlockBandedMatrixZeros(::Type{T}, KR, JR, (l,u), (λ,μ), rt, dt) where {T}
274267
J = first(JR)
275268
K = first(KR)
276269
bl_sh = Int(J) - Int(K)
277270

278271
KBR = blocklengthrange(rt,KR)
279272
KJR = blocklengthrange(dt,JR)
280273

281-
BandedBlockBandedMatrix(Zeros{eltype(KO)}(sum(KBR),sum(KJR)),
282-
AbstractVector{Int}(KBR),AbstractVector{Int}(KJR), (l+bl_sh,u-bl_sh), (λ,μ))
274+
BandedBlockBandedMatrix(Zeros{T}(sum(KBR),sum(KJR)),
275+
convert(AbstractVector{Int}, KBR),
276+
convert(AbstractVector{Int}, KJR),
277+
(l+bl_sh,u-bl_sh), (λ,μ))
278+
end
279+
function BandedBlockBandedMatrix(::Type{Zeros}, S::SubOperator{<:Any,<:Any,Tuple{BlockRange1,BlockRange1}})
280+
KR,JR = parentindices(S)
281+
KO = parent(S)
282+
l,u = blockbandwidths(KO)::Tuple{Int,Int}
283+
λ,μ = subblockbandwidths(KO)::Tuple{Int,Int}
284+
_BandedBlockBandedMatrixZeros(eltype(KO), KR, JR, (l,u), (λ,μ), rangespace(KO), domainspace(KO))
283285
end
284286

285287

src/Operators/general/algebra.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,10 @@ for TYP in (:Matrix, :BandedMatrix, :RaggedMatrix)
439439
return $TYP(BandedMatrix(V))
440440
end
441441
elseif isbandedblockbanded(P)
442-
N = block(rangespace(P), last(parentindices(V)[1]))
443-
M = block(domainspace(P), last(parentindices(V)[2]))
444-
B = P[Block(1):N, Block(1):M]
445-
return $TYP(view(B, parentindices(V)...), _colstops(V))
442+
N = block(rangespace(P), last(parentindices(V)[1]))::Block{1,Int}
443+
M = block(domainspace(P), last(parentindices(V)[2]))::Block{1,Int}
444+
B = P[Block(1):N, Block(1):M]::AbstractMatrix{T}
445+
return $TYP(view(B, parentindices(V)...), _colstops(V))::$TYP{T}
446446
end
447447

448448
kr, jr = parentindices(V)

0 commit comments

Comments
 (0)