Skip to content

Commit eb5537c

Browse files
committed
Fix indexing columns
1 parent 7c3a9b6 commit eb5537c

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/bidiag.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ function _mul!(C::AbstractVecOrMat, A::BiTriSym, B::AbstractVecOrMat, _add::MulA
955955
iszero(_add.alpha) && return _rmul_or_fill!(C, _add.beta)
956956
if nA == 1
957957
A11 = @inbounds A[1,1]
958-
for i in 1:nB
958+
for i in axes(B, 2)
959959
@inbounds _modify!(_add, A11 * B[1,i], C, (1,i))
960960
end
961961
return C

test/bidiag.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,4 +1192,12 @@ end
11921192
@test_throws msg ldiv!(C, B, zeros(2,1))
11931193
end
11941194

1195+
@testset "1-row mul" begin
1196+
B = Bidiagonal(2:2, 1:0, :U)
1197+
for v in ([3], fill(3, 1, 4))
1198+
@test mul!(zero(v), B, v) == 2v
1199+
@test mul!(2v, B, v, 2, 2) == 8v
1200+
end
1201+
end
1202+
11951203
end # module TestBidiagonal

test/tridiag.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,4 +1184,14 @@ end
11841184
@test convert(SymTridiagonal, S) == S
11851185
end
11861186

1187+
@testset "1-row mul" begin
1188+
for T in (Tridiagonal(1:0, 2:2, 1:0),
1189+
SymTridiagonal(2:2, 1:0))
1190+
for v in ([3], fill(3, 1, 4))
1191+
@test mul!(zero(v), T, v) == 2v
1192+
@test mul!(2v, T, v, 2, 2) == 8v
1193+
end
1194+
end
1195+
end
1196+
11871197
end # module TestTridiagonal

0 commit comments

Comments
 (0)