Skip to content

Commit 02045d4

Browse files
committed
Update error messages
1 parent abbd086 commit 02045d4

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/bidiag.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,9 @@ function ldiv!(c::AbstractVecOrMat, A::Bidiagonal, b::AbstractVecOrMat)
12531253
N = size(A, 1)
12541254
mb, nb = size(b, 1), size(b, 2)
12551255
if N != mb
1256-
throw(DimensionMismatch(lazy"first dimension of A, $N, does not match first dimension of b, $mb"))
1256+
dimstr = b isa AbstractVector ? "length" : "first dimension"
1257+
throw(DimensionMismatch(LazyString(lazy"the first dimension of the Bidiagonal matrix, $N, ",
1258+
lazy"does not match the $dimstr of the right-hand-side, $mb")))
12571259
end
12581260
mc, nc = size(c, 1), size(c, 2)
12591261
if mc != mb || nc != nb

test/bidiag.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,4 +1180,15 @@ end
11801180
@test !isreal(im*M)
11811181
end
11821182

1183+
@testset "ldiv! error message" begin
1184+
C = zeros(2)
1185+
B = Bidiagonal(1:0, 1:0, :U)
1186+
msg = "size of result, (2,), does not match the size of b, (0, 1)"
1187+
@test_throws msg ldiv!(C, B, zeros(0,1))
1188+
msg = "the first dimension of the Bidiagonal matrix, 0, does not match the length of the right-hand-side, 2"
1189+
@test_throws msg ldiv!(C, B, zeros(2))
1190+
msg = "the first dimension of the Bidiagonal matrix, 0, does not match the first dimension of the right-hand-side, 2"
1191+
@test_throws msg ldiv!(C, B, zeros(2,1))
1192+
end
1193+
11831194
end # module TestBidiagonal

0 commit comments

Comments
 (0)