Skip to content

Commit

Permalink
Tests for A^p for (secretly) Hermitian and diagonal
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Jul 31, 2017
1 parent 09371a5 commit f9fd542
Showing 1 changed file with 30 additions and 0 deletions.
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

0 comments on commit f9fd542

Please sign in to comment.