Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BandedMatrices"
uuid = "aae01518-5342-5314-be14-df237901396f"
version = "0.17.3"
version = "0.17.4"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
6 changes: 5 additions & 1 deletion src/banded/BandedLU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ function lu!(A::BandedMatrix{T}, pivot::Union{Val{false}, Val{true}} = Val(true)
end
m= size(A,1)
l,u = bandwidths(A) # l of the bands are ignored and overwritten
_, ipiv = LAPACK.gbtrf!(l, u-l, m, bandeddata(A))
if !iszero(m)
_, ipiv = LAPACK.gbtrf!(l, u-l, m, bandeddata(A))
else
ipiv = Int[]
end
return BandedLU{T,typeof(A)}(A, ipiv, zero(BlasInt))
end

Expand Down
3 changes: 2 additions & 1 deletion src/banded/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function ldiv!(A::BandedLU{T,<:BandedMatrix}, B::StridedVecOrMat{T}) where {T<:B
m = size(A.factors,1)
l,u = bandwidths(A.factors)
data = bandeddata(A.factors)
LAPACK.gbtrs!('N', l, u-l, m, data, A.ipiv, B)
iszero(m) || LAPACK.gbtrs!('N', l, u-l, m, data, A.ipiv, B)
B
end

function ldiv!(A::BandedLU{T}, B::AbstractVecOrMat{Complex{T}}) where T<:Real
Expand Down
9 changes: 9 additions & 0 deletions test/test_bandedlu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,13 @@ struct _foo <: Number end
@test_throws BoundsError size(BLU, -1)
@test_throws BoundsError size(BLU, 0)
end

@testset "zero matrix" begin
for A in (BandedMatrix{Float64}(undef, 0,0, 1,1),
BandedMatrix{Float64}(undef, 0,3, 1,1),
BandedMatrix{Float64}(undef, 0,0, -1,-2))
@test lu(A).factors == zeros(size(A)...)
@test lu(A) \ zeros(0) == zeros(0)
end
end
end