Measurements
measure
TensorMixedStates.measure
— Functionmeasure(state, args[, t])
measure(state, measure[, t])
measure(state, [measures...][, t])
compute the requested measurements on the given state and simulation time
It is more efficient to ask all required measurements in one call
Examples
measure(state, X(1)) # compute observable X(1)
measure(state, X) # compute observable X on all sites
measure(state, (X, Y)) # compute correlations XY on all pairs of sites
measure(state, Check("check", X(1)X(2), t->sin(2t)), 0.8) # compute and check the given observable against a computed value
measure(state, [X(2), Y, (X, Y)]) # several measures together
TensorMixedStates.StateFunc
— Typestruct StateFunc
StateFunc(name, obs)
a data type to represent a function of State
. This is used by measure
.
TensorMixedStates.Check
— Typestruct Check
Check(name, obs1, obs2[, tol])
a measurement that checks the equality between two measurements. It throws an error if the difference is larger than tol.
TensorMixedStates.Measure
— Typestruct Measure
Measure(args...)
a data type to hold a set of measurements, used internally
ITensorMPS.expect
— Functionexpect(::State, obs)
Compute expectation values of obs
on the given state.
Examples
expect(state, X(1)*Y(2) + Y(1)*Z(3))
expect(state, [X(1)*Y(2), X(3), Z(1)*X(2)])
TensorMixedStates.expect1
— Functionexpect1(::State, op)
Compute the expectation values of the given operators on all sites.
Examples
expect1(state, X)
expect1(state, [X, Y, Z])
TensorMixedStates.expect2
— Functionexpect2(::State, op_pairs)
Compute the expectation values of the given pairs of operators on all sites.
Examples
expect2(state, (X, X))
expect2(state, [(X, Y), (X, Z), (Y, Z)])
...
TensorMixedStates.entanglement_entropy
— Functionentanglement_entropy(::State, ::Int)
Return the entanglement entropy of the given state at the given site. Also return the associated spectrum.
Types of measurements
There are five types of measurements we can ask to measure
With an indexed operator, we get the expectation of the corresponding observable
mesure(state, X(1)X(2)Z(4))
With a generic operator (acting on one site only), we get the expectation of the operator on each site
measure(state, X)
With a couple of generic operators, we get the correlation matrix of those observators
measure(state, (X, Y))
There are a some state functions predefined:
measure(state, Trace) # returns the trace of the state
measure(state, Trace2) # returns the trace of the square of the state (alternate name: Purity)
measure(state, TraceError) # returns 1 - trace, usefull for monitoring trace deviations
measure(state, EE(l, n)) # returns entanglement entropy at site n and first n singular values
measure(state, Hermitianity) # returns 1 if density matrix is really Hermitian and down to 0 for anti Hermitian density matrix
measure(state, HermitianityError) # return 1 - Hermitianity for monitoring hermitianity deviation
New state functions may be defined by
stfunc = StateFunc(name, state->... )
Checks can be performed (useful for coherence tests)
measure(state, Check(name, obs1, obs2)) # returns 3 values ob1, obs2 and |obs2 - obs1|
messure(state, Check(name, obs1, obs2, tol)) # if |obs2 - obs1|>tol throw an error
measure(state, Check(name, obs1, obs2), t)
In Check
, obs may also be constants, vectors and function of time (like t -> sin(t)
), in this case the simulation time must be fed to measure
as 3rd argument.
Output
TensorMixedStates.output
— Functionoutput(::Simulation, [ filename => measure1, ... ])
compute the given measurements on a simultation and output them to the associated file or dict
filenames are interpreted by get_sim_file (see there for special values)
Examples
output(sim, "file" => [X, X(1)Y(2), (X, Y)])
output(sim, [ "file1" => [X, Y(2)], "file2" => Trace])
TensorMixedStates.log_msg
— Functionlog_msg(::Simulation, text)
log the given message on the "log" file of the simulation