From 6866f5e79f5f086bcb2f3e97cfbc30c9fd64fd22 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Fri, 8 Dec 2023 13:27:08 +0530 Subject: [PATCH 1/2] Wrap parent of PDMat in Hermitian in eigmin/eigmax --- src/pdmat.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pdmat.jl b/src/pdmat.jl index abaec69..3c02104 100644 --- a/src/pdmat.jl +++ b/src/pdmat.jl @@ -84,8 +84,8 @@ end Base.inv(a::PDMat) = PDMat(inv(a.chol)) LinearAlgebra.det(a::PDMat) = det(a.chol) LinearAlgebra.logdet(a::PDMat) = logdet(a.chol) -LinearAlgebra.eigmax(a::PDMat) = eigmax(a.mat) -LinearAlgebra.eigmin(a::PDMat) = eigmin(a.mat) +LinearAlgebra.eigmax(a::PDMat) = eigmax(Hermitian(a.mat)) +LinearAlgebra.eigmin(a::PDMat) = eigmin(Hermitian(a.mat)) Base.kron(A::PDMat, B::PDMat) = PDMat(kron(A.mat, B.mat), Cholesky(kron(A.chol.U, B.chol.U), 'U', A.chol.info)) LinearAlgebra.sqrt(A::PDMat) = PDMat(sqrt(Hermitian(A.mat))) From 77fff47b148da72e82563c93a6c8a12b03aec83a Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Fri, 8 Dec 2023 13:46:19 +0530 Subject: [PATCH 2/2] Use `Symmetric` instead of `Hermitian` Co-authored-by: David Widmann --- src/pdmat.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pdmat.jl b/src/pdmat.jl index 3c02104..0cc754b 100644 --- a/src/pdmat.jl +++ b/src/pdmat.jl @@ -84,8 +84,8 @@ end Base.inv(a::PDMat) = PDMat(inv(a.chol)) LinearAlgebra.det(a::PDMat) = det(a.chol) LinearAlgebra.logdet(a::PDMat) = logdet(a.chol) -LinearAlgebra.eigmax(a::PDMat) = eigmax(Hermitian(a.mat)) -LinearAlgebra.eigmin(a::PDMat) = eigmin(Hermitian(a.mat)) +LinearAlgebra.eigmax(a::PDMat) = eigmax(Symmetric(a.mat)) +LinearAlgebra.eigmin(a::PDMat) = eigmin(Symmetric(a.mat)) Base.kron(A::PDMat, B::PDMat) = PDMat(kron(A.mat, B.mat), Cholesky(kron(A.chol.U, B.chol.U), 'U', A.chol.info)) LinearAlgebra.sqrt(A::PDMat) = PDMat(sqrt(Hermitian(A.mat)))