Skip to content

Commit

Permalink
Test physical and virtual inds
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Aug 14, 2024
1 parent 10b5f10 commit 74320fa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/Quantum_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
@test nsites(qtn; set=:outputs) == 1
@test issetequal(sites(qtn), [site"1"])
@test socket(qtn) == State(; dual=false)
@test inds(qtn; at=site"1") == :i
@test issetequal(inds(qtn; set=:physical), [:i])
@test isempty(inds(qtn; set=:virtual))

# forwarded methods to `TensorNetwork`
@test TensorNetwork(qtn) == tn
Expand All @@ -20,6 +23,9 @@
@test nsites(qtn; set=:outputs) == 0
@test issetequal(sites(qtn), [site"1'"])
@test socket(qtn) == State(; dual=true)
@test inds(qtn; at=site"1'") == :i
@test issetequal(inds(qtn; set=:physical), [:i])
@test isempty(inds(qtn; set=:virtual))

_tensors = Tensor[Tensor(zeros(2, 2), [:i, :j])]
tn = TensorNetwork(_tensors)
Expand All @@ -28,6 +34,10 @@
@test nsites(qtn; set=:outputs) == 1
@test issetequal(sites(qtn), [site"1", site"1'"])
@test socket(qtn) == Operator()
@test inds(qtn; at=site"1") == :i
@test inds(qtn; at=site"1'") == :j
@test issetequal(inds(qtn; set=:physical), [:i, :j])
@test isempty(inds(qtn; set=:virtual))

_tensors = Tensor[Tensor(fill(0))]
tn = TensorNetwork(_tensors)
Expand All @@ -36,6 +46,8 @@
@test nsites(qtn; set=:outputs) == 0
@test isempty(sites(qtn))
@test socket(qtn) == Scalar()
@test isempty(inds(qtn; set=:physical))
@test isempty(inds(qtn; set=:virtual))

# detect errors
_tensors = Tensor[Tensor(zeros(2), [:i]), Tensor(zeros(2), [:i])]
Expand Down

0 comments on commit 74320fa

Please sign in to comment.