-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
D = 1 # bond dimension
N = 2 # physical space
operator = TensorMap(rand, Float64, ℂ^N ← ℂ^N)
# un-normalized random state
state = FiniteMPS([TensorMap(rand, ComplexF64, ℂ^D ⊗ ℂ^N ← ℂ^D), TensorMap(rand, ComplexF64, ℂ^D ⊗ ℂ^N ← ℂ^D)])
val1 = expectation_value(state, 1 => operator) + expectation_value(state, 2 => operator)
val2 = expectation_value(state, @mpoham sum(operator{i} for i in vertices(FiniteChain(2))))
val1 ≈ val2 # false
# normalized random state
state = FiniteMPS([TensorMap(rand, ComplexF64, ℂ^D ⊗ ℂ^N ← ℂ^D), TensorMap(rand, ComplexF64, ℂ^D ⊗ ℂ^N ← ℂ^D)], normalize = true)
val1 = expectation_value(state, 1 => operator) + expectation_value(state, 2 => operator)
val2 = expectation_value(state, @mpoham sum(operator{i} for i in vertices(FiniteChain(2))))
val1 ≈ val2 # trueexpectation_value seems to normalize the state if the operator acts on all sites (or if its an MPOHamiltonian?), but not if the operator is local. Seems like an edge case that isn't encountered usually and I don't know if its intentional, but probably should be documented.
Metadata
Metadata
Assignees
Labels
No labels