Skip to content

Commit 4bce535

Browse files
committed
fix lapack tests for new eig ordering
1 parent f84ac18 commit 4bce535

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/linalg/lapack.jl

+9-5
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ end
230230
@testset for elty in (Complex64, Complex128)
231231
A = rand(elty,10,10)
232232
Aw, Avl, Avr = LAPACK.geev!('N','V',copy(A))
233+
LinAlg.sorteig!(Aw,Avr)
233234
fA = eigfact(A)
234235
@test fA[:values] Aw
235236
@test fA[:vectors] Avr
@@ -529,18 +530,21 @@ end
529530
@testset "trrfs & trevc" begin
530531
@testset for elty in (Float32, Float64, Complex64, Complex128)
531532
T = triu(rand(elty,10,10))
533+
i = sortperm(diag(T), by=LinAlg.eigsortby)[1]
532534
S = copy(T)
533535
select = zeros(Base.LinAlg.BlasInt,10)
534-
select[1] = 1
536+
select[i] = 1
535537
select,Vr = LAPACK.trevc!('R','S',select,copy(T))
536-
@test Vr eigvecs(S)[:,1]
538+
v = eigvecs(S)[:,1]
539+
@test Vr v * Vr[i] / v[i]
537540
select = zeros(Base.LinAlg.BlasInt,10)
538-
select[1] = 1
541+
select[i] = 1
539542
select,Vl = LAPACK.trevc!('L','S',select,copy(T))
540543
select = zeros(Base.LinAlg.BlasInt,10)
541-
select[1] = 1
544+
select[i] = 1
542545
select,Vln,Vrn = LAPACK.trevc!('B','S',select,copy(T))
543-
@test Vrn eigvecs(S)[:,1]
546+
v = eigvecs(S)[:,1]
547+
@test Vrn v * Vrn[i] / v[i]
544548
@test Vln Vl
545549
@test_throws ArgumentError LAPACK.trevc!('V','S',select,copy(T))
546550
@test_throws DimensionMismatch LAPACK.trrfs!('U','N','N',T,rand(elty,10,10),rand(elty,10,11))

0 commit comments

Comments
 (0)