Skip to content

Inconsistent normalization when computing expectation value #194

@20akshay00

Description

@20akshay00
    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 # true

expectation_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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions