Skip to content

Commit

Permalink
Add Sergio's suggested changes for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
HerManNav committed Oct 10, 2024
1 parent 751a959 commit 88b6ccb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/Transformations_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,32 +152,32 @@

# Test that the resulting tn contains no tensors with larger rank than the original
rank = length size parent
@test max(rank.(tensors(reduced))...) <= max(rank.(tensors(tn))...)
@test maximum(ndims, tensors(reduced)) <= maximum(ndims, tensors(tn))

# Test that the resulting tn contains <= tensors than the original
@test length(tensors(reduced)) <= length(tensors(tn))
@test Tenet.ntensors(reduced) <= Tenet.ntensors(tn)

# Test that the resulting contraction contains the same as the original
@test contract(reduced) contract(tn)

# Options (for non-recursive)
# Test that a non-recursive contraction is an intermediate simplification
reduced_nonrecursive = transform(tn, ContractSimplification(:length, false))
@test length(tensors(tn)) > length(tensors(reduced_nonrecursive)) > length(tensors(reduced))
@test Tenet.ntensors(tn) > Tenet.ntensors(reduced_nonrecursive) > Tenet.ntensors(reduced)

# 2nd-stage simplification result in full simplification for this TN
reduced_full = transform(reduced_nonrecursive, ContractSimplification(:length, false))
@test length(tensors(reduced)) == length(tensors(reduced_full))
@test Tenet.ntensors(reduced) == Tenet.ntensors(reduced_full)

@test contract(reduced) contract(tn)

# Options (minimization by rank)
# Test that the resulting tn contains no tensors with larger rank than the original
reduced_byrank = transform(tn, ContractSimplification(:rank, true))
@test max(rank.(tensors(reduced_byrank))...) <= max(rank.(tensors(tn))...)
@test maximum(ndims, tensors(reduced_byrank)) <= maximum(ndims, tensors(tn))

# Test that the resulting number of tensors is bigger for a reduction by rank than for length
@test length(tensors(reduced_byrank)) > length(tensors(reduced))
@test Tenet.ntensors(reduced_byrank) > Tenet.ntensors(reduced)
end

@testset "AntiDiagonalGauging" begin
Expand Down

0 comments on commit 88b6ccb

Please sign in to comment.