Skip to content

Commit

Permalink
fixed the failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanMaertens committed Sep 25, 2023
1 parent cd9fe69 commit 472e496
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
4 changes: 0 additions & 4 deletions src/environments/FinEnv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ function environments(
)
end

function environments(below, opp::TimedOperator, above, leftstart, rightstart)
return environments(below, opp.op, above, leftstart, rightstart)
end

function environments::WindowMPS, windowH::Window)
lenvs = environments.left_gs, windowH.left)
renvs = environments.right_gs, windowH.right)
Expand Down
2 changes: 1 addition & 1 deletion src/operators/multipliedoperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ Base.:*(x::MultipliedOperator, v) = x(v);

# don't know a better place to put this
# environment for MultipliedOperator
environments(st, x::MultipliedOperator) = environments(st, x.op)
environments(st,x::MultipliedOperator,args...;kwargs...) = environments(st,x.op,args...;kwargs...)
6 changes: 3 additions & 3 deletions test/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ end
alg = TDVP()

# with regular MPOHamiltonian
H0left = simpleH
H0middle = repeat(simpleH, 20) # (= Hmiddle)
H0right = simpleH
H0left = simpleH;
H0middle = repeat( simpleH, 20);
H0right = simpleH;

Ψ = InfiniteMPS([ℂ^2], [ℂ^20])
Ψwindow = WindowMPS(Ψ, 20)
Expand Down
13 changes: 2 additions & 11 deletions test/states.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,8 @@ end
period = rand(1:4)
Ψ = InfiniteMPS(fill(d, period), fill(D, period))

Ψwindow = WindowMPS(rand, ComplexF64, rand(5:10), d, D, Ψ) #does copy Ψ or not?

@test Ψwindow.left_gs !== Ψwindow.right_gs # not the same reference
@test Ψwindow.left_gs Ψwindow.right_gs # but the same state

Ψwindow.left_gs.AC[1] *= 2
@test abs(norm(Ψwindow.left_gs) - norm(Ψwindow.right_gs)) > 0.5
@test abs(norm(Ψwindow.left_gs) - norm(Ψ)) > 0.5

Ψwindow = WindowMPS(rand, ComplexF64, rand(5:10), d, D, Ψ, Ψ)
@test Ψwindow.left_gs == Ψwindow.right_gs # the same reference
Ψwindow = WindowMPS(rand, ComplexF64, rand(5:10), d, D, Ψ, Ψ); # version that does not copy
@test Ψwindow.left_gs === Ψwindow.right_gs # the same reference

Ψwindow_copied = copy(Ψwindow)
@test Ψwindow_copied.left_gs !== Ψwindow_copied.right_gs # not the same reference
Expand Down

0 comments on commit 472e496

Please sign in to comment.