Skip to content

Commit dcd1fb2

Browse files
authored
LAPACK: validate input parameters to throw informative errors (JuliaLang#53631)
This PR validates the input parameters to the Julia LAPACK wrappers, so that the error messages are more informative. On nightly ```julia julia> using LinearAlgebra julia> LAPACK.geev!('X', 'X', rand(2,2)) ** On entry to DGEEV parameter number 1 had an illegal value ERROR: ArgumentError: invalid argument #1 to LAPACK call ``` This PR ```julia julia> using LinearAlgebra julia> LAPACK.geev!('X', 'X', rand(2,2)) ERROR: ArgumentError: argument #1: jobvl must be one of ('N', 'V'), but 'X' was passed ``` Secondly, moved certain allocations (e.g. in `geevx`) below the validation checks, so that these only happen for valid parameter values. Thirdly, added `require_one_based_indexing` checks to functions where these were missing.
1 parent dcfad21 commit dcd1fb2

File tree

3 files changed

+344
-82
lines changed

3 files changed

+344
-82
lines changed

stdlib/LinearAlgebra/src/blas.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ end
168168
"Check that upper/lower (for special matrices) is correctly specified"
169169
function chkuplo(uplo::AbstractChar)
170170
if !(uplo == 'U' || uplo == 'L')
171-
throw(ArgumentError(lazy"uplo argument must be 'U' (upper) or 'L' (lower), got $uplo"))
171+
throw(ArgumentError(lazy"uplo argument must be 'U' (upper) or 'L' (lower), got '$uplo'"))
172172
end
173173
uplo
174174
end

0 commit comments

Comments
 (0)