From 4e0b095132e2ba88a3907b73ae3301b5168863d6 Mon Sep 17 00:00:00 2001 From: Jofre Date: Mon, 17 Jul 2023 16:55:41 +0200 Subject: [PATCH 1/4] Remove legacy test code and update it with fixes --- test/Transformations_test.jl | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/test/Transformations_test.jl b/test/Transformations_test.jl index 49762d8d..5c1f3822 100644 --- a/test/Transformations_test.jl +++ b/test/Transformations_test.jl @@ -76,7 +76,7 @@ ) # Test that the resulting contraction returns the same as the original - # @test contract(reduced) ≈ contract(tn) + @test contract(reduced) ≈ contract(tn) end @testset "openinds" begin @@ -111,7 +111,7 @@ end # Test that the resulting contraction returns the same as the original - # @test contract(reduced) ≈ contract(tn) + @test contract(reduced) ≈ contract(tn) end end @@ -136,13 +136,7 @@ @test length(tensors(reduced)) ≤ length(tensors(tn)) # Test that the resulting contraction contains the same as the original - # TODO: the permutation will not be necessary if https://github.com/bsc-quantic/Tensors.jl/issues/27 is fixed - contracted_reduced = contract(reduced) - contracted_tn = contract(tn) - - # Calculate the permutation for the `reduced` tensor labels to match `tn` - perm = sortperm(collect(labels(contracted_reduced)), by = x -> findfirst(==(x), collect(labels(contracted_tn)))) - @test permutedims(contracted_reduced, perm) ≈ contracted_tn + @test contract(reduced) ≈ contract(tn) end @testset "AntiDiagonalGauging" begin @@ -191,9 +185,7 @@ end # Test that the resulting contraction is the same as the original - # TODO: Change for: @test contract(gauged) ≈ contract(tn), when is fixed - A_2, B_2, C_2 = tensors(gauged) - @test contract(A, contract(B, C)) ≈ contract(A_2, contract(B_2, C_2)) + @test contract(gauged) ≈ contract(tn) end @testset "ColumnReduction" begin @@ -222,9 +214,7 @@ @test length(tn.indices) > length(reduced.indices) # Test that the resulting contraction is the same as the original - # TODO: Change for: @test contract(reduced) ≈ contract(tn), when is fixed - A_2, B_2, C_2 = tensors(reduced) - @test contract(A, contract(B, C, dims = [])) ≈ contract(A_2, contract(B_2, C_2, dims = [])) + @test contract(reduced) ≈ contract(contract(A, B; dims=[]), C) end @testset "index size reduction" begin @@ -243,15 +233,13 @@ # Test that all the tensors in reduced have no columns and they have smaller dimensions in the 2nd :j index for tensor in tensors(reduced) @test isempty(Tenet.find_zero_columns(parent(tensor))) - # @assert size(tensor, :j) == 2 + @test size(tensor, :j) == 2 end @test length(tn.indices) == length(reduced.indices) # Test that the resulting contraction is the same as the original - # TODO: Change for: @test contract(reduced) ≈ contract(tn), when is fixed - A_2, B_2, C_2 = tensors(reduced) - @test contract(A, contract(B, C, dims = [])) ≈ contract(A_2, contract(B_2, C_2, dims = [])) + @test contract(reduced) ≈ view(contract(tn), :j => 1:2:3) end end @@ -278,9 +266,6 @@ @test smallest_deleted > largest_new # Test that the resulting contraction is the same as the original - # TODO: Change for: @test contract(reduced) ≈ contract(tn), when is fixed - A_2, B_2, C_2, D_2, E_2 = tensors(reduced) - c_reduced = contract(contract(contract(contract(A_2, B_2), C_2), D_2), E_2) - @test contract(contract(tensors(tn)[1], tensors(tn)[2]), tensors(tn)[3]) ≈ c_reduced + @test contract(reduced) ≈ contract(tn) end end From 33dea1aa92cde37f0e67fe62120e4e68cf845a59 Mon Sep 17 00:00:00 2001 From: Jofre Date: Tue, 18 Jul 2023 09:34:20 +0200 Subject: [PATCH 2/4] Update Tensors compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index dcb908b4..d3f2448a 100644 --- a/Project.toml +++ b/Project.toml @@ -45,6 +45,6 @@ OMEinsum = "0.7" Permutations = "0.4" Quac = "0.2" Requires = "1.3" -Tensors = "0.1.9" +Tensors = "0.1.10" ValSplit = "0.1" julia = "1.8" From e7a6ee88a0dcb1c9250fe50be9624dfaf4a250c6 Mon Sep 17 00:00:00 2001 From: Jofre Date: Tue, 18 Jul 2023 10:28:51 +0200 Subject: [PATCH 3/4] Update Tensors compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index d3f2448a..36fe2906 100644 --- a/Project.toml +++ b/Project.toml @@ -45,6 +45,6 @@ OMEinsum = "0.7" Permutations = "0.4" Quac = "0.2" Requires = "1.3" -Tensors = "0.1.10" +Tensors = "0.1.11" ValSplit = "0.1" julia = "1.8" From cf1cf1d2fb4a90389378466a4aaf441aeab829ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= <15837247+mofeing@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:29:02 +0200 Subject: [PATCH 4/4] Update `DeltaArrays` dependency to v0.1.1 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 36fe2906..14253457 100644 --- a/Project.toml +++ b/Project.toml @@ -34,7 +34,7 @@ TenetQuacExt = "Quac" [compat] Bijections = "0.1" Combinatorics = "1.0" -DeltaArrays = "0.1.0" +DeltaArrays = "0.1.1" EinExprs = "0.2" GraphMakie = "0.4,0.5" Graphs = "1.7"