Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions stdlib/LinearAlgebra/src/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3835,7 +3835,7 @@ for (stev, stebz, stegr, stein, elty) in
eev = copy(ev)
eev[n] = zero($elty)
else
throw(DimensionMismatch("ev has length $(length(ev)) but should be either $(length(dv) - 1) or $(length(dv))"))
throw(DimensionMismatch("ev has length $ne but needs one less than or equal to dv's length, $n)"))
end

abstol = Vector{$elty}(undef, 1)
Expand Down Expand Up @@ -3878,10 +3878,15 @@ for (stev, stebz, stegr, stein, elty) in
require_one_based_indexing(dv, ev_in, w_in, iblock_in, isplit_in)
chkstride1(dv, ev_in, w_in, iblock_in, isplit_in)
n = length(dv)
if length(ev_in) != n - 1
throw(DimensionMismatch("ev_in has length $(length(ev_in)) but needs one less than dv's length, $n)"))
ne = length(ev_in)
if ne == n - 1
ev = [ev_in; zero($elty)]
elseif ne == n
ev = copy(ev_in)
ev[n] = zero($elty)
else
throw(DimensionMismatch("ev_in has length $ne but needs one less than or equal to dv's length, $n)"))
end
ev = [ev_in; zeros($elty,1)]
ldz = n #Leading dimension
#Number of eigenvalues to find
if !(1 <= length(w_in) <= n)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/test/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ end
@test_throws DimensionMismatch LAPACK.stev!('U',d,rand(elty,11))
@test_throws DimensionMismatch LAPACK.stebz!('A','B',zero(elty),zero(elty),0,0,-1.,d,rand(elty,10))
@test_throws DimensionMismatch LAPACK.stegr!('N','A',d,rand(elty,11),zero(elty),zero(elty),0,0)
@test_throws DimensionMismatch LAPACK.stein!(d,zeros(elty,10),zeros(elty,10),zeros(BlasInt,10),zeros(BlasInt,10))
@test_throws DimensionMismatch LAPACK.stein!(d,zeros(elty,11),zeros(elty,10),zeros(BlasInt,10),zeros(BlasInt,10))
@test_throws DimensionMismatch LAPACK.stein!(d,e,zeros(elty,11),zeros(BlasInt,10),zeros(BlasInt,10))
end
end
Expand Down
2 changes: 2 additions & 0 deletions stdlib/LinearAlgebra/test/tridiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ end
F2 = eigen(A2)
test_approx_eq_modphase(F.vectors, F2.vectors)
@test F.values ≈ F2.values ≈ eigvals(A) ≈ eigvals(A2)
@test eigvecs(A) ≈ eigvecs(A2)
@test eigvecs(A, eigvals(A)[1:1]) ≈ eigvecs(A2, eigvals(A2)[1:1])
end

@testset "non-commutative algebra (#39701)" begin
Expand Down