Skip to content

Commit

Permalink
add basic testing for FiniteMPS center, indexing and slicing functi…
Browse files Browse the repository at this point in the history
…onality
  • Loading branch information
VictorVanthilt committed Dec 24, 2024
1 parent a662903 commit 25f8ad1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/states.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ end
@test dot(ψ_small, ψ_small2) dot(ψ_small, ψ_small)
end

@testset "FiniteMPS center + (slice) indexing" begin
L = 11
ψ = FiniteMPS(L, ℂ^2, ℂ^16)

ψ.AC[6] # moving the center to site 6

@test ψ.center == 6

@test ψ[5] == ψ.ALs[5]
@test ψ[6] == ψ.ACs[6]
@test ψ[7] == ψ.ARs[7]

@test ψ[5:7] ==.ALs[5], ψ.ACs[6], ψ.ARs[7]]

@inferred ψ[5]

@test_throws BoundsError ψ[0]
@test_throws BoundsError ψ[L + 1]

ψ.C[6] = randn(ComplexF64, space.C[6])) # setting the center between sites 5 and 6
@test ψ.center == 13 / 2
@test ψ[5:7] ==.ALs[5], ψ.ACs[6], ψ.ARs[7]]
end

@testset "InfiniteMPS ($(sectortype(D)), $elt)" for (D, d, elt) in
[(ℙ^10, ℙ^2, ComplexF64),
(Rep[U₁](1 => 3), Rep[U₁](0 => 1),
Expand Down

0 comments on commit 25f8ad1

Please sign in to comment.