Measurements

What is measured

measure(state, measurement) returns the value of one measurement, and measure(state, measurements; time, values...) those of a list, in their order, as pairs name => value, as v[i] and v[[i]] give an element and a vector. A measurement is an operator, a measurement of the library, a symbol, or a function of the context, each possibly named, and a list of them is a vector or a Measure, which keeps what it prepares for the next call, as a phase keeps its lists while it runs. The examples below use a four qubit state

using TensorMixedStates, .Qubits

mystate = State{Mixed}(System(4, Qubit()), ["+", "Up", "+", "Dn"])

With an operator placed on sites, we get its expectation value

measure(mystate, X(1)X(3)Z(4))
-1.0

With an operator of one site, its expectation value on each site

measure(mystate, X)
4-element Vector{Float64}:
 1.0
 0.0
 1.0
 0.0

With a pair of operators of one site, the matrix of their correlations

measure(mystate, (X, Y))
4×4 Matrix{ComplexF64}:
 0.0+0.0im  0.0+0.0im  0.0+0.0im  0.0+0.0im
 0.0+0.0im  0.0+1.0im  0.0+0.0im  0.0+0.0im
 0.0+0.0im  0.0+0.0im  0.0+0.0im  0.0+0.0im
 0.0+0.0im  0.0+0.0im  0.0+0.0im  0.0-1.0im

The library measures the state as a whole:

measurementvalue
Tracethe trace of the state, a complex number
TraceDeviation1 - trace, which numerical errors tend to move, a complex number
Purity$\mathrm{tr}(\rho^\dagger\rho)/(\mathrm{tr}\,\rho)^2$, $\mathrm{tr}(\rho^2)$ for a density matrix of trace one, 1 on a pure state
Normthe norm of the state
Hermiticity1 for a Hermitian density matrix, down to 0 for an anti-Hermitian one
HermiticityDeviation1 - hermiticity, the squared norm of the anti-Hermitian part relative to that of the whole
Renyi2the Rényi entropy of order 2 of the state
Renyi2(positions)the Rényi entropy of order 2 of the sites at positions, 1:k for the first k
MutualInfoRenyi2(positions)the Rényi-2 mutual information between the sites at positions and the others
VonNeumannEntropy(positions)the von Neumann entropy of the sites at positions, from their reduced density matrix
ReducedDensityMatrix(positions)the density matrix of the sites at positions, a complex matrix, see reduced_density_matrix
LogNegativity(positions_a, positions_b)the logarithmic negativity between the sites of positions_a and those of positions_b
EntanglementEntropy(cut)the entanglement entropy across the cut between sites cut and cut+1, the operator space entanglement entropy (OSEE) on a mixed representation
EntanglementSpectrum(cut, n)the first n values of the spectrum the entropy is computed from, padded with zeros, see entanglement_spectrum
Fidelity(ref)the fidelity with the reference state ref, or with the state of that name in a simulation, Fidelity(:ground)
Overlap(ref)the inner product with the reference state ref, a complex number, or with a state named in a simulation
Overlap(ref, op)the matrix element $\langle ref \vert op \vert state \rangle$ of two pure states, or its vector for an operator of one site on every site, the correlations at two times of a reference evolved with the state
Variance(op)the variance of the operator op
MaxLinkdimthe maximum bond dimension of the state
MemoryUsagethe memory the state occupies in bytes, the caches of the measurements included
measure(mystate, [Trace, Purity, EntanglementEntropy(2)])
3-element Vector{Pair{String, Any}}:
                  "Trace" => 0.9999999999999996 + 0.0im
                 "Purity" => 1.0
 "EntanglementEntropy(2)" => 0.0

Anything else is measured by a function of the context c, named: c.state is the state, c.time the time given to measure, and the other values given to it are read as c.energy, for instance. A symbol stands for the value of that name:

measure(mystate, ["half_trace" => c -> trace(c.state) / 2, "cos" => c -> cos(2c.time), :energy];
        time = 0.3, energy = -1.5)
3-element Vector{Pair{String, Any}}:
 "half_trace" => 0.4999999999999998
        "cos" => 0.8253356149096783
     "energy" => -1.5

A list given after the name of a state, :φ => [Z, (X, X), Purity], measures the state of that name with all of the above, its measurements named after it, φ.Z, φ.(X, X) and φ.Purity, as their columns are:

measure(mystate, [Z(1), :reference => [Z(1), Purity]];
        reference = State{Pure}(System(4, Qubit()), "Dn"))
3-element Vector{Pair{String, Any}}:
             "Z(1)" => 0.0
   "reference.Z(1)" => -1.0
 "reference.Purity" => 1.0

In a simulation, the values are those its phases provide: :step the number of steps the phase has done, the sweeps of a search, :energy the energy of each sweep of GroundState, :residual for SteadyState the eigenvalue of $L^\dagger L$, zero for a steady state, and :beta and :log_trace the inverse temperature and the logarithm of the trace of Thermalize, see thermalize. A state named in a simulation, by CopyState for instance, is a value as well, and Update provides the values it declares. A measurement reading a value that no phase provides is refused when the simulation is written, see SimData.

A function of the context may return a Check, which compares a value with a reference:

measure(mystate, "check" => c -> Check(expect(c.state, X(1)), 1.0; tol = 1e-8))
(value = 1.0, reference = 1.0, difference = 0.0)

The value is then the value, the reference and their distance, and a distance beyond tol is an error, or only a warning with warn = true. Without tol, the three are recorded and nothing is refused.

Real and complex values

The value of an operator is real when the operator is Hermitian, which is tested numerically, and complex otherwise, whatever the state, so that the columns of a file do not change during a run. A pair (A, B) is Hermitian when A and B are, commute on a site and are not both fermionic: (X, Y), whose diagonal is $\langle XY \rangle = i \langle Z \rangle$, is complex. The imaginary part of the value of a Hermitian operator is dropped, with a warning when it is more than rounding, which a density matrix that lost its hermiticity gives; a simulation gathers these warnings into one at the end of each phase. Trace, TraceDeviation, Overlap and ReducedDensityMatrix are complex, the other measurements of the library real, and a function of the context gives what it returns.

expect, expect1 and expect2 give their values by the same rule. With complex = true, they give the complex numbers computed, imaginary parts included, which a list of measurements gets through a function: "x" => c -> expect(c.state, X(1); complex = true).

Two copies of the state

The quantities quadratic in the density matrix are inner products of the density matrix with itself through a channel or a generator, see inner, each a contraction as expect makes on a density matrix:

quantitywritten as
$\mathrm{tr}\,\rho^2$inner(ρ, ρ)
$\mathrm{tr}(\rho K \rho K^\dagger)$inner(ρ, Gate(K), ρ)
$\mathrm{tr}(A \rho^2)$, A Hermitianinner(ρ, Evolver(A / 2), ρ)

Divided by $\mathrm{tr}\,\rho^2$, the second is, for K a product of operators on two sites, a Rényi-2 correlator of the mixed state, and the third the mean value of A in $\rho^2 / \mathrm{tr}\,\rho^2$, which virtual distillation estimates; for an A that is not Hermitian, the third gives that of its Hermitian part. A list of measurements takes them through a function:

"C2" => c -> inner(c.state, Gate(X(1) * X(5)), c.state) / inner(c.state, c.state)

Reference

TensorMixedStates.measure — Function
measure(state, measurement; time, values...)
measure(state, measurements; time, values...)

the value of one measurement on state, or those of a list of them, a vector, a Measure or :φ => list, as a vector of pairs name => value in their order, as v[i] and v[[i]] give an element and a vector. An operator placed on sites gives its expectation value, an operator of one site a vector indexed by site and a pair a matrix, as expect1 and expect2 give them, made real when the operator, or each product of the pair, is Hermitian, with a warning when the imaginary part dropped is beyond rounding, and complex otherwise; any other value is given as it is computed, a Check as (value, reference, difference). time and the values are what a measurement written as a function reads as c.time and c.energy, and what a symbol stands for, a symbol of the list without a value being refused before anything is measured. A Measure keeps its preparation, which a list given as it is makes anew at each call.

Examples

measure(state, Purity)
measure(state, [X, (X, Y), Z(1) * Z(2), Purity])
measure(state, ["E" => H, "cos" => c -> cos(2c.time), :energy]; time = 1.5, energy = -3.2)
source
TensorMixedStates.Check — Type
Check(value, reference; tol = nothing, warn = false)

what a measurement written as a function returns to compare value with reference, numbers or arrays of one shape: measure gives (value, reference, difference), the difference being norm(value - reference) over the entries both have, missing when one misses an entry the other has, and refuses a difference beyond tol or missing, or only warns with warn = true. Without tol, the three are recorded and nothing is refused.

Examples

"check_cos" => c -> Check(expect(c.state, X(1)), cos(2c.time); tol = 1e-6)
source
TensorMixedStates.Measure — Type
Measure(measurements...)
Measure([measurements...])

a list of measurements, measured together by measure, which prepares it once for each system it is measured on and keeps that preparation. Each measurement is one of

  • an operator placed on sites, X(1) * X(2), measured by expect
  • an operator of one site, X, measured on every site where it is defined by expect1
  • a pair of them, (X, Y), measured on every pair of sites by expect2
  • a measurement of the library, as Purity or EntanglementEntropy(3)
  • a symbol, :energy, the value of that name given to measure
  • "name" => m, m one of these or a function of the context c: c.state, c.time and the values given to measure, c.energy
  • :φ => list, the measurements of the list made on the state named φ, a value given to measure, their names prefixed by φ.

A vector, or a Measure, inside the list stands for its measurements. Two measurements of a list cannot share a name.

Examples

Measure(X, (X, Y), Z(1) * Z(2), Purity, "E" => H, "cos" => c -> cos(2c.time), :energy)
source
ITensorMPS.expect — Function
expect(state, op; complex = false)

the expectation value of the operator op, placed on sites, or the array or the tuple of those of an array or a tuple of them, on the state of an extension as well, through its expect_value, divided by the real part of the trace of the state: $\langle\psi|op|\psi\rangle / \langle\psi|\psi\rangle$ on a pure state, $\mathrm{tr}(op\,\rho) / \mathrm{tr}\,\rho$ on a mixed one. Its factors may come in any order, act on several sites, and the Jordan-Wigner strings of fermionic operators are laid for you. On a system conserving charges, an operator changing them by no definite amount is measured on the state conserving nothing, see weaken. A channel, a generator and an operator not placed on sites, X rather than X(1), see expect1, are refused.

The value of a Hermitian operator is real, as measure gives it, its imaginary part dropped, with a warning when it is more than rounding, as a density matrix that lost its hermiticity gives; that of any other operator is complex, and an array of values of both kinds complex. With complex = true, the value is the complex number computed, imaginary part included. The system of the state keeps an operator of several terms prepared once it is asked for twice.

Examples

expect(state, X(1) * Y(2) + Y(1) * Z(3))
expect(state, [X(1) * Y(2), X(3), Swap(1, 3)])
expect(state, C(3) * dag(C)(1))
expect(ρ, X(1); complex = true)
source
TensorMixedStates.expect1 — Function
expect1(state, op; complex = false)

the expectation values of the operator of one site op on every site, normalised as by expect: a vector indexed by site, missing where op is not defined, or, for an array of operators, an array of such vectors arranged as the operators. The values of an operator Hermitian on every site where it is defined are real, the others complex, and all of them the complex numbers computed with complex = true, as for expect. The even part of the operator on a site is measured there on the density matrix of the site, its odd part with the Jordan-Wigner string on the sites before, both from environments the state keeps. On the state of an extension, each value is measured by its expect_value.

Examples

expect1(state, X)
expect1(state, [X, Y, Z])
source
TensorMixedStates.expect2 — Function
expect2(state, (o1, o2); sites, complex = false)
expect2(state, [(o1, o2), ...]; sites, complex = false)

the matrix whose entry (i, j) is the expectation value of o1(i) * o2(j), normalised as by expect, the diagonal being that of (o1 * o2)(i), for i and j in sites (all sites by default), missing elsewhere and where o1 is not defined on i or o2 on j; for a vector of pairs, a vector of such matrices. The matrix of a pair whose products are all Hermitian, o1 and o2 Hermitian, commuting on a site and not both fermionic, is real, the others complex, and all of them the complex numbers computed with complex = true, as for expect. The Jordan-Wigner strings are laid for you. A pair whose operators have one and the same parity on all those sites is measured by sharing the environments of each site, any other row by row, each part of definite parity with its string. On the state of an extension, each entry is measured by its expect_value.

Examples

expect2(state, (X, X))
expect2(state, [(X, Y), (C, dag(C))]; sites = 1:10)
source
TensorMixedStates.variance — Function
variance(state, op)
variance(state::State{Pure}, mpo::MPO)

the variance $\langle H^\dagger H\rangle - |\langle H\rangle|^2$ of the operator op, placed on sites, $\langle H^2\rangle - \langle H\rangle^2$ for a Hermitian one, or of the operator of mpo, on state, which need not be normalised, an operator changing the charges by no definite amount being measured on the state conserving nothing, as by expect. On a density matrix $\rho$ of trace one, it is $\mathrm{tr}(\rho H^\dagger H) - |\mathrm{tr}(\rho H)|^2$.

Examples

variance(ground_state, hamiltonian)
β^2 * variance(thermal_state, hamiltonian)      # the specific heat
source
ITensorMPS.sample — Method
sample(::State [; rng])
sample(::State, pos [; rng])
sample(::State, op [; rng])

a random outcome of measuring the state in the basis of its sites, numbered from 0: a vector with one outcome per site, or, given pos, the outcome of that site alone; or, given a Hermitian operator placed on a few sites, one of its eigenvalues, see probabilities. The state is left as it is, see collapse. rng is the random number generator, the global one by default.

Examples

sample(state)
sample(state, 3)
sample(state, Z(1) * Z(2))
source
TensorMixedStates.probabilities — Function
probabilities(state, pos)
probabilities(state, op)

the results of measuring site pos, or the Hermitian operator op placed on a few sites, with their probabilities, as pairs result => probability in increasing order, those of zero probability included, a probability below rounding being zero: the levels of the site, counted from 0, or the eigenvalues of op, to rounding. The matrix of op on its sites is diagonalized, its size being the product of their dimensions, except for two kinds of operators measured on any number of sites: a product of involutions, as a string of Pauli operators, by its mean value, and a sum of operators of one site with half integer eigenvalues, as the number of particles of a region, by the mean values of products of phases.

Examples

probabilities(state, 3)
probabilities(state, Z(1) * Z(2))
probabilities(state, sum(N(i) for i in 1:10))
source
TensorMixedStates.collapse — Function
collapse(state, pos [; rng])
collapse(state, op [; rng, limits])
collapse(state, pos => x)
collapse(state, op => λ [; limits])

the result of measuring site pos, or the Hermitian operator op placed on a few sites, its probability, and the state it leaves, (result, probability, state): the result is drawn with its probability, see probabilities, or given as a pair, pos => x or op => λ, a result that is not possible or of zero probability being refused, and the state is projected onto it and normalized. The projection on several sites is truncated by limits, Limits() by default: for a product of involutions, the state plus its image by the product, which at most doubles the bond dimension, or quadruples it on a density matrix; for a sum of operators of one site, an MPO whose bond carries the partial sums, as many as its dimension; otherwise the projector, with the Jordan-Wigner strings of the fermionic sites between its sites, refused when it leaves the state without definite charges, on a system conserving them, see weaken. rng is the random number generator, the global one by default.

Examples

x, p, state = collapse(state, 3)
λ, p, state = collapse(state, X(3))
s, p, state = collapse(state, Z(1) * Z(2); limits = Limits(maxdim = 100))
_, p, state = collapse(state, Z(1) * Z(2) => 1)
source
TensorMixedStates.entanglement_entropy — Function
entanglement_entropy(state, cut::Int)

the entanglement entropy across the cut between sites cut and cut + 1, that of the spectrum entanglement_spectrum gives. cut runs from 1 to the number of sites, the last one giving 0. On a mixed representation, this is the operator space entanglement entropy (OSEE).

Examples

entanglement_entropy(state, 3)   # cut between sites 3 and 4
source
TensorMixedStates.entanglement_spectrum — Function
entanglement_spectrum(state, cut::Int)

the entanglement spectrum across the cut between sites cut and cut + 1, the eigenvalues of the reduced density matrix of the sites up to cut in decreasing order, whose entropy entanglement_entropy gives; on a mixed representation, the spectrum of the operator space entanglement entropy

Examples

entanglement_spectrum(state, 3)   # cut between sites 3 and 4
source
TensorMixedStates.entanglement_by_sector — Function
entanglement_by_sector(state::State{Pure}, cut::Int)

the entanglement across the cut between sites cut and cut + 1, resolved by the charge of the sites up to cut: a dictionary from the charges of each sector, the pairs name => charge of the quantities conserved in the order of their names, to (weight, entropy, spectrum), the probability of that charge and the entropy and decreasing spectrum of the reduced density matrix restricted to it and normalised. A sector is read by its charges as fully_mixed takes them, in any order, sectors[N => 2] or sectors[Ntot => 4, 2Sz => 0]. The entanglement entropy is Σ weight * entropy - Σ weight * log(weight), the second sum being the number entropy. A state conserving nothing has the single sector (); a mixed representation is refused.

Examples

sectors = entanglement_by_sector(state, 3)   # cut between sites 3 and 4
sectors[N => 2].weight
source
TensorMixedStates.renyi2 — Function
renyi2(::State)
renyi2(::State, positions::AbstractVector{Int})

the Rényi entropy of order 2, $-\log \mathrm{tr}(\rho^2)$, of the state, 0 on a pure representation; given positions, that of the state reduced to those sites, 0 when there is none. On a pure state, positions forming a block at an end, 1:k or k:n, read the Schmidt spectrum of the cut, as cheap as entanglement_entropy; any others mix the state first, which is much more expensive.

Examples

renyi2(state, 1:3)
source
TensorMixedStates.mutual_info_renyi2 — Function
mutual_info_renyi2(state, positions::AbstractVector{Int})

the Rényi-2 analogue of the mutual information between two parts of the state, $S_2(A) + S_2(B) - S_2(A \cup B)$, which can be negative on a mixed state: part A at positions, part B the rest. An empty part gives 0. On a pure state it is twice the renyi2 of part A, at the same cost, but on fermions, whose state may have no definite parity, where it is the sum of the renyi2 of the two parts.

Examples

mutual_info_renyi2(state, 1:3)
source
TensorMixedStates.reduced_density_matrix — Function
reduced_density_matrix(state, positions)

the density matrix of the sites at positions, the others traced out, as a matrix of trace one on the basis of the product states of those sites, given in increasing order, ordered as kron orders them, the first site varying the slowest, as for dense_state. On fermionic sites it is written in the Jordan-Wigner basis of the sites kept alone, so that tr(ρ * matrix(op, ...)) is the expectation value of op placed on them. It is meant for a few sites, the matrix having the square of their dimension as its number of elements, and refused beyond the dimension dense_max, 4096. A state of trace zero is refused, and so are positions out of increasing order, which permute_sites gives.

Examples

ρ = reduced_density_matrix(state, [2, 5])
source
TensorMixedStates.von_neumann_entropy — Function
von_neumann_entropy(state, positions)

the von Neumann entropy $-\mathrm{tr}\,\rho_A \log \rho_A$ of the sites at positions, $\rho_A$ being their reduced_density_matrix, 0 when there is none; the eigenvalues of zero or below, which an approximate state may have, are left out. On a pure state and the sites 1:cut, entanglement_entropy(state, cut) gives the same, at a far lower cost and for any number of sites.

Examples

von_neumann_entropy(state, [2, 5])
source
TensorMixedStates.log_negativity — Function
log_negativity(state, a, b)

the logarithmic negativity $\log \|\rho^{T_B}\|_1$ between the sites at a and those at b, $\rho$ being their reduced_density_matrix and $T_B$ the partial transpose on b, zero for a separable state and 0 when a part is empty. The partial transpose in the Jordan-Wigner basis is not the fermionic one: it is taken on a part holding no fermionic site, and refused when both hold one.

Examples

log_negativity(state, [1, 2], [5])
source
TensorMixedStates.Trace — Constant
Trace

the measurement of the trace of the state, see trace, with its imaginary part: a complex number, whatever the state, so that its columns do not change during a run

source
TensorMixedStates.HermiticityDeviation — Constant
HermiticityDeviation

the measurement of 1 - hermiticity(state), see Hermiticity: the squared norm of the anti-Hermitian part of the density matrix relative to that of the whole

source
TensorMixedStates.Renyi2 — Constant
Renyi2
Renyi2(positions)

the measurement of the Rényi-2 entropy of the state, or of the sites at positions, see renyi2

Examples

Renyi2(1:3)
source
TensorMixedStates.Fidelity — Function
Fidelity(ref)
Fidelity(name)

the measurement of the fidelity with the reference state ref, see fidelity, the two taken on what both conserve; given a name, the reference is the value of that name, a state named in the simulation, missing while there is none

source
TensorMixedStates.Overlap — Function
Overlap(ref[, op])
Overlap(name[, op])

the measurement of the inner product with the reference state ref, see inner, the two taken on what both conserve, a complex number whatever the states, as Trace; given a name, the reference is the value of that name, as for Fidelity. With an operator, the matrix element $\langle ref | op | state \rangle$ of two pure states, of an operator placed on sites, or the vector of those of an operator of one site on every site: from a reference A|ψ⟩ evolved with the state |ψ⟩, the correlations $\langle A^\dagger(0) op(t) \rangle$ at two times.

Examples

Overlap(:excited)
Overlap(:kicked, Z)            # ⟨kicked|Z_i|state⟩ for every site i
source
TensorMixedStates.Variance — Function
Variance(op)

the measurement of the variance of the operator op, see variance, its MPO built once for each system on a pure state

source
TensorMixedStates.MutualInfoRenyi2 — Function
MutualInfoRenyi2(positions)

the measurement of the Rényi-2 mutual information between the sites at positions and the others, see mutual_info_renyi2

source
TensorMixedStates.ReducedDensityMatrix — Function
ReducedDensityMatrix(positions)

the measurement of the density matrix of the sites at positions, in increasing order, see reduced_density_matrix, a complex matrix whatever the state, as Trace

source
TensorMixedStates.EntanglementSpectrum — Function
EntanglementSpectrum(cut, n)

the measurement of the first n values of the entanglement spectrum across the cut between sites cut and cut + 1, see entanglement_spectrum, padded with zeros beyond the bond dimension of the cut, so that every row of a file has the same width

source

Output

output takes measurements and writes them to destinations, as the phases of runTMS do with their measurements, given as pairs destination => measurements. The destinations are

  • a file name: a text table, a line naming the columns, then a line per time measured, the numbers written with the format of the simulation, SimData(format = "%.13g") by default. A file holds one list of measurements, and another list needs another file. Its columns are those of its first line: a value that changes its cells later, as that of a state named after it, missing at first, needs a JSON Lines file.

    "magnetization" => [X, Z(1)]
  • "stdout" or "-", and "stderr": a text table on the stream, written again with its new columns when the list changes; "" writes nothing.

  • a file name ending in .jsonl: JSON Lines, an object for each time measured, written as it is measured, the time and each measurement under its name, a vector as an array, a matrix as the array of its rows and a complex number as an object, as {"time":0.1,"X":[0.5,0.5],"Trace":{"re":1.0,"im":0.0}}. A name ending in .json gives the array of these objects, a JSON document whose closing bracket is written when the run ends.

    "data.jsonl" => [Purity, X(2)Z(3), (X, Y)]
  • Data(name): the rows are kept in memory, in the data of the Simulation that runTMS returns, each the time then the pairs name => value measured, row["X(1)"] reading a value as it was measured. The rows are also a table, of the package Tables.jl, whose columns are those of a text table of the same measurements, below, which DataFrame(rows), CSV.write(file, rows) and data_to_frame(rows) take.

    Data("mydata") => [TraceDeviation, X(1), Y]
  • a TensorMixedStates.Destination of one's own.

The columns of a table are time, then a column per value: the name of the measurement, as X(1)*X(3) for an operator placed on sites, X(i) for each site of an operator of one site, X(i)Y(j) for each pair of sites of a pair, m(i) and m(i,j) when they are named m, m[i] and m[i,j] for the entries of a vector or of a matrix of another measurement, and m.field for those of a named tuple. A complex value takes the two columns Re(m) and Im(m). The files runTMS writes itself in the directory of the simulation cannot be destinations: log, stop, restart, error, running, stamp, description, prog.jl, prog_args.json and the checkpoint files.

mysim = runTMS(simdata)
rows = mysim.data["mydata"]
rows[end]["X(1)"]           # the last value of X(1)
df = data_to_frame(rows)    # with using DataFrames, the same as DataFrame(rows)
TensorMixedStates.output — Function
output(sim, destination => measurements)
output(sim, [destination1 => measurements1, ...])

measure each list on the state of the simulation, at its time and with its values, and write it to its destination: a file name, "stdout", "stderr", "" or Data(name), see Destination and measure. The files are taken in the directory of the simulation, whose own files are refused.

Examples

output(sim, "magnetization" => [X, Z(1)])
output(sim, [ "energy" => :energy, Data("purity") => Purity ])
source
TensorMixedStates.Destination — Type
Destination

where measurements are written: a description, compared by value, opened once and given a row at each call. TMS writes text tables, to files and to the streams of the process, JSON files, all named by a string, and Data. A package adds its own by a subtype and these methods of TensorMixedStates, o being the destination opened, o = open(d):

  • write_row(o, time, row): write row, the pairs name => value that measure returns, measured at time
  • close(o)
  • check_list(o, names), optional: refuse a list of measurements, by their names, that it cannot take, before anything is measured
  • resume_mark(o) and open(d, mark), optional: a mark that a resumed simulation reopens the destination at, nothing by default, the destination then starting anew
source