Skip to content

Commit

Permalink
Check arguments in wrapper for xheevr. Add tests for errors reported in
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Aug 19, 2014
1 parent 64e21a3 commit e03700a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions base/linalg/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2985,6 +2985,12 @@ for (syev, syevr, sygvd, elty, relty) in
function syevr!(jobz::BlasChar, range::BlasChar, uplo::BlasChar, A::StridedMatrix{$elty}, vl::FloatingPoint, vu::FloatingPoint, il::Integer, iu::Integer, abstol::FloatingPoint)
chkstride1(A)
n = chksquare(A)
if range == 'I'
1 <= il <= iu <= n || throw(ArgumentError("illegal choise of eigenvalue indices"))
end
if range == 'V'
vl < vu || throw(ArgumentError("lower boundary must be less than upper boundary"))
end
lda = max(1,stride(A,2))
m = Array(BlasInt, 1)
w = similar(A, $relty, n)
Expand Down
8 changes: 8 additions & 0 deletions test/linalg4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,11 @@ A7933 = [1 2; 3 4]
B7933 = copy(A7933)
C7933 = full(Symmetric(A7933))
@test A7933 == B7933

# Issues #8057 and #8058
for f in (eigfact, eigvals)
for A in (Symmetric(randn(2,2)), Hermitian(complex(randn(2,2), randn(2,2))))
@test_throws ArgumentError f(A, 3, 2)
@test_throws ArgumentError f(A, 1:4)
end
end

0 comments on commit e03700a

Please sign in to comment.