Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
Add tests for adjoint in Chain
Browse files Browse the repository at this point in the history
  • Loading branch information
jofrevalles committed Jun 20, 2024
1 parent 9bc0cd4 commit 70c7978
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/Ansatz/Chain_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -380,5 +380,18 @@
isapprox(norm(qtn), 1.0)
end

@testset "adjoint" begin
qtn = rand(Chain, Open, State; n = 5, p = 2, χ = 10)
adjoint_qtn = adjoint(qtn)

for i in 1:nsites(qtn)
i < nsites(qtn) &&
@test rightindex(adjoint_qtn, Site(i; dual = true)) == Symbol(String(rightindex(qtn, Site(i))) * "'")
i > 1 && @test leftindex(adjoint_qtn, Site(i; dual = true)) == Symbol(String(leftindex(qtn, Site(i))) * "'")
end

@test isapprox(contract(TensorNetwork(qtn)), contract(TensorNetwork(adjoint_qtn)))
end

# TODO test `evolve!` methods
end

0 comments on commit 70c7978

Please sign in to comment.