diff --git a/test/diagonal.jl b/test/diagonal.jl index e5fcaa430..0f67836dd 100644 --- a/test/diagonal.jl +++ b/test/diagonal.jl @@ -200,6 +200,16 @@ diagspacelist = ((ℂ^4)', ℂ[Z2Irrep](0 => 2, 1 => 3), @test all(((s, t),) -> isapprox(s, t), zip(values(LinearAlgebra.eigvals(D)), values(LinearAlgebra.eigvals(t)))) + D, W = @constinferred eig!(t) + @test D === t + @test W == one(t) + @test t * W ≈ W * D + D2, V2 = @constinferred eigh!(t2) + if T <: Real + @test D2 === t2 + end + @test V2 == one(t) + @test t2 * V2 ≈ V2 * D2 end @testset "leftorth with $alg" for alg in (TensorKit.QR(), TensorKit.QL()) Q, R = @constinferred leftorth(t; alg=alg) diff --git a/test/tensors.jl b/test/tensors.jl index cd0071b2e..2b73d49bd 100644 --- a/test/tensors.jl +++ b/test/tensors.jl @@ -490,6 +490,11 @@ for V in spacelist for (c, b) in s @test b ≈ s′[c] end + s = LinearAlgebra.svdvals(t2') + s′ = LinearAlgebra.diag(S') + for (c, b) in s + @test b ≈ s′[c] + end end @testset "cond and rank" begin t2 = permute(t, ((3, 4, 2), (1, 5))) @@ -507,6 +512,10 @@ for V in spacelist λmax = maximum(s -> maximum(abs, s), values(vals)) λmin = minimum(s -> minimum(abs, s), values(vals)) @test cond(t4) ≈ λmax / λmin + vals = LinearAlgebra.eigvals(t4') + λmax = maximum(s -> maximum(abs, s), values(vals)) + λmin = minimum(s -> minimum(abs, s), values(vals)) + @test cond(t4') ≈ λmax / λmin end end @testset "empty tensor" begin