Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for A^p for (secretly) Hermitian and diagonal #23060

Closed
wants to merge 1 commit into from
Closed
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
30 changes: 30 additions & 0 deletions test/linalg/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,36 @@ end
@test (Ad^0.2)^5 Ad
@test (Ad^(2/3))*(Ad^(1/3)) Ad
@test (Ad^im)^(-im) Ad

#Ah : Hermitian Matrix
Ah = convert(Matrix{elty}, [3 1; 1 3])
if elty <: Base.LinAlg.BlasComplex
Ah += [0 im; -im 0]
end
@test Ah^(1/2) sqrtm(Ah)
@test Ah^(-1/2) inv(sqrtm(Ah))
@test Ah^(3/4) sqrtm(Ah) * sqrtm(sqrtm(Ah))
@test Ah^(-3/4) inv(Ah) * sqrtm(sqrtm(Ah))
@test Ah^(17/8) Ah^2 * sqrtm(sqrtm(sqrtm(Ah)))
@test Ah^(-17/8) inv(Ah^2 * sqrtm(sqrtm(sqrtm(Ah))))
@test (Ah^0.2)^5 Ah
@test (Ah^(2/3))*(Ah^(1/3)) Ah
@test (Ah^im)^(-im) Ah

#ADi : Diagonal Matrix
ADi = convert(Matrix{elty}, [3 0; 0 3])
if elty <: Base.LinAlg.BlasComplex
ADi += [im 0; 0 im]
end
@test ADi^(1/2) sqrtm(ADi)
@test ADi^(-1/2) inv(sqrtm(ADi))
@test ADi^(3/4) sqrtm(ADi) * sqrtm(sqrtm(ADi))
@test ADi^(-3/4) inv(ADi) * sqrtm(sqrtm(ADi))
@test ADi^(17/8) ADi^2 * sqrtm(sqrtm(sqrtm(ADi)))
@test ADi^(-17/8) inv(ADi^2 * sqrtm(sqrtm(sqrtm(ADi))))
@test (ADi^0.2)^5 ADi
@test (ADi^(2/3))*(ADi^(1/3)) ADi
@test (ADi^im)^(-im) ADi
end

@testset "Least squares solutions" begin
Expand Down