Skip to content

Commit 6e8049b

Browse files
authored
Don't error in lmul!/rmul! with non-zero entries (#171)
* Don't error in lmul!/rmul! with non-zero entries * add tests
1 parent 821853b commit 6e8049b

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BlockBandedMatrices"
22
uuid = "ffab5731-97b5-5995-9138-79e8c1846df0"
3-
version = "0.12.5"
3+
version = "0.12.6"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/broadcast.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,17 +250,13 @@ end
250250

251251

252252
function blockbanded_rmul!(B::AbstractMatrix{T}, x::Number) where T
253-
x == zero(T) || throw(BandError(B))
254-
255253
for J = blockaxes(B,2), K = blockcolsupport(B,J)
256254
rmul!(view(B,K,J), x)
257255
end
258256
B
259257
end
260258

261259
function blockbanded_lmul!(x::Number, B::AbstractMatrix{T}) where T
262-
x == zero(T) || throw(BandError(B))
263-
264260
for J = blockaxes(B,2), K = blockcolsupport(B,J)
265261
lmul!(x, view(B,K,J))
266262
end

test/test_linalg.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ import BlockBandedMatrices: _BandedBlockBandedMatrix, MemoryLayout, mul!,
1818
C.data .= NaN
1919
rmul!(C, 0.0)
2020
norm(C) == 0.0
21+
22+
C.data .= 1
23+
@test lmul!(2, C) == fill(2,3,3)
24+
25+
A = BlockBandedMatrix{Float64}(undef, 1:2,1:2, (1,1))
26+
A.data .= 1
27+
lmul!(2, A)
28+
@test A == fill(2,3,3)
29+
rmul!(A, 2)
30+
@test A == fill(4,3,3)
2131
end
2232

2333
@testset "BlockBandedMatrix linear algebra" begin

0 commit comments

Comments
 (0)