Skip to content

Commit 2fea65e

Browse files
committed
Ensure positive-definite matrix in lapack posv test
1 parent 4c9e125 commit 2fea65e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/lapack.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,11 @@ end
687687
@testset for elty in (Float32, Float64, ComplexF32, ComplexF64)
688688
local n = 10
689689
a = randn(elty, n, n)
690-
A = a'*a
690+
# generate a symmetric positive definite matrix as Q*D*Q',
691+
# where Q is orthogonal, and D contains the eigenvalues
692+
Q, _ = qr(a)
693+
D = Diagonal(rand(real(elty), n) .+ real(oneunit(elty)))
694+
A = Matrix(Hermitian(Q*D*Q')) # ensure that the matrix is exactly hermitian
691695
B = rand(elty, n, n)
692696
D = copy(A)
693697
C = copy(B)

0 commit comments

Comments
 (0)