Skip to content

Commit 5cdeb46

Browse files
authored
don't refer to internal variable names in gemv exceptions (#1141)
Currently, the `DimensionMismatch` exceptions refer to internal parameter names of `gemv!`, which is confusing because those don't necessarily match the caller's variables. For example: ```jl julia> B = rand(1000,100); c = rand(1000); julia> B * c ERROR: DimensionMismatch: second dimension of A, 100, does not match length of x, 1000 Stacktrace: [1] gemv! @ ~/.julia/juliaup/julia-1.11.2+0.x64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/matmul.jl:438 [inlined] ``` This PR changes the error messages to refer to "matrix" instead of "A" and "input vector" instead of "x", etc.
1 parent 4a3dbf8 commit 5cdeb46

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/matmul.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,9 @@ Base.@constprop :aggressive function gemv!(y::StridedVector{T}, tA::AbstractChar
572572
α::Number=true, β::Number=false) where {T<:BlasFloat}
573573
mA, nA = lapack_size(tA, A)
574574
nA != length(x) &&
575-
throw(DimensionMismatch(lazy"second dimension of A, $nA, does not match length of x, $(length(x))"))
575+
throw(DimensionMismatch(lazy"second dimension of matrix, $nA, does not match length of input vector, $(length(x))"))
576576
mA != length(y) &&
577-
throw(DimensionMismatch(lazy"first dimension of A, $mA, does not match length of y, $(length(y))"))
577+
throw(DimensionMismatch(lazy"first dimension of matrix, $mA, does not match length of output vector, $(length(y))"))
578578
mA == 0 && return y
579579
nA == 0 && return _rmul_or_fill!(y, β)
580580
alpha, beta = promote(α, β, zero(T))
@@ -603,9 +603,9 @@ Base.@constprop :aggressive function gemv!(y::StridedVector{Complex{T}}, tA::Abs
603603
α::Number = true, β::Number = false) where {T<:BlasReal}
604604
mA, nA = lapack_size(tA, A)
605605
nA != length(x) &&
606-
throw(DimensionMismatch(lazy"second dimension of A, $nA, does not match length of x, $(length(x))"))
606+
throw(DimensionMismatch(lazy"second dimension of matrix, $nA, does not match length of input vector, $(length(x))"))
607607
mA != length(y) &&
608-
throw(DimensionMismatch(lazy"first dimension of A, $mA, does not match length of y, $(length(y))"))
608+
throw(DimensionMismatch(lazy"first dimension of matrix, $mA, does not match length of output vector, $(length(y))"))
609609
mA == 0 && return y
610610
nA == 0 && return _rmul_or_fill!(y, β)
611611
alpha, beta = promote(α, β, zero(T))
@@ -627,9 +627,9 @@ Base.@constprop :aggressive function gemv!(y::StridedVector{Complex{T}}, tA::Abs
627627
α::Number = true, β::Number = false) where {T<:BlasReal}
628628
mA, nA = lapack_size(tA, A)
629629
nA != length(x) &&
630-
throw(DimensionMismatch(lazy"second dimension of A, $nA, does not match length of x, $(length(x))"))
630+
throw(DimensionMismatch(lazy"second dimension of matrix, $nA, does not match length of input vector, $(length(x))"))
631631
mA != length(y) &&
632-
throw(DimensionMismatch(lazy"first dimension of A, $mA, does not match length of y, $(length(y))"))
632+
throw(DimensionMismatch(lazy"first dimension of matrix, $mA, does not match length of output vector, $(length(y))"))
633633
mA == 0 && return y
634634
nA == 0 && return _rmul_or_fill!(y, β)
635635
alpha, beta = promote(α, β, zero(T))

0 commit comments

Comments
 (0)