-
-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
JuliaLang/julia
#54276Labels
Description
I noticed a problem with Hermitian
matrices, especially the inverse of them. For any given invertible square matrix x,
x / x
and x \ x
should be the identity matrix (or at least close to it). Invoking this on a Hermitian
complex matrix y = Hermitian(x)
results in a filled complex matrix, that is not even hermitian. At least y / y
is the hermitian conjugate of y \ y
.
Using z = hermitianpart(y)
does however give correct results for z / z
and z \ z
. Notably, z == y
and typeof(z) == typeof(y)
is true
. The inverse also works for Hermitian real matrices.
Minimal working example:
using LinearAlgebra
x = rand(ComplexF64,2,2)
y = Hermitian(x)
z = hermitianpart(y)
y \ y ≈ I
y / y ≈ I
z \ z ≈ I
z / z ≈ I
Output is false
for
y \ y ≈ I
y / y ≈ I
but expected to be true
.
Output of versioninfo():
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 4 × Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 3 on 4 virtual cores
Environment:
JULIA_NUM_THREADS = 3