Skip to content

Commit 0087a11

Browse files
jishnubKristofferC
authored andcommitted
LAPACK: validate input parameters to throw informative errors (#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. (cherry picked from commit dcd1fb2)
1 parent 641ae2c commit 0087a11

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
@@ -169,7 +169,7 @@ end
169169
"Check that upper/lower (for special matrices) is correctly specified"
170170
function chkuplo(uplo::AbstractChar)
171171
if !(uplo == 'U' || uplo == 'L')
172-
throw(ArgumentError(lazy"uplo argument must be 'U' (upper) or 'L' (lower), got $uplo"))
172+
throw(ArgumentError(lazy"uplo argument must be 'U' (upper) or 'L' (lower), got '$uplo'"))
173173
end
174174
uplo
175175
end

0 commit comments

Comments
 (0)