pygsti.tools.optools

pygsti.tools.optools#

Utility functions operating on operation matrices

Module Attributes

EFFECT_EIGVAL_ABSTOL_WARN

Single source of truth for how far a (POVM-effect) eigenvalue may fall outside [0, 1] before rootconj_superop() warns / raises, respectively, when forming E½.

Functions

average_gate_fidelity(a, b[, mx_basis, ...])

Computes the average gate fidelity (AGF) between two gates.

average_gate_infidelity(a, b[, mx_basis, ...])

Computes the average gate infidelity (AGI) between two gates.

bulk_create_elementary_errorgen_nqudit(typ, ...)

Construct the elementary error generator matrices, either in a dense or sparse representation, corresponding to the specified types and list of basis element subscripts.

bulk_create_elementary_errorgen_nqudit_dual(...)

Construct the dual elementary error generator matrices, either in a dense or sparse representation, corresponding to the specified types and list of basis element subscripts.

compute_best_case_gauge_transform(gate_mx, ...)

Returns a gauge transformation that maps gate_mx into a matrix that is co-diagonal with target_gate_mx.

compute_povm_map(model, povmlbl)

Constructs a gate-like quantity for the POVM within model.

create_elementary_errorgen_nqudit(typ, ...)

Construct the elementary error generator matrix, either in a dense or sparse representation, corresponding to the specified type and basis element subscripts.

create_elementary_errorgen_nqudit_dual(typ, ...)

Construct the dual elementary error generator matrix, either in a dense or sparse representation, corresponding to the specified type and basis element subscripts.

decompose_gate_matrix(operation_mx)

Decompose a gate matrix into fixed points, axes of rotation, angles of rotation, and decay rates.

diamonddist(a, b[, mx_basis, return_x])

Returns the approximate diamond norm describing the difference between gate matrices.

dmvec_to_state(dmvec[, tol])

Compute the pure state describing the action of density matrix vector dmvec.

effect_label_to_outcome(povm_and_effect_lbl)

Extract the outcome label from a "simplified" effect label.

effect_label_to_povm(povm_and_effect_lbl)

Extract the POVM label from a "simplified" effect label.

eigenvalue_fidelity(x, y[, gauge_invariant])

For positive semidefinite matrices (x, y), define M(x,y) = √(√x · y · √x).

eigenvalue_infidelity(a, b[, gauge_invariant])

elementary_errorgens(dim, typ, basis)

Compute the elementary error generators of a certain type.

elementary_errorgens_dual(dim, typ, basis)

Compute the set of dual-to-elementary error generators of a given type.

entanglement_fidelity(a, b[, mx_basis, ...])

Returns the "entanglement" process fidelity between gate matrices.

entanglement_infidelity(a, b[, mx_basis, ...])

Returns the entanglement infidelity (EI) between gate matrices.

error_generator(gate, target_op, mx_basis[, ...])

Construct the error generator from a gate and its target.

extract_elementary_errorgen_coefficients(...)

Extract a dictionary of elemenary error generator coefficients and rates from the specified dense error generator matrix.

fast_density_rank(mat[, scalar_tol, rng])

mat is Hermitian of order n.

fidelity(a, b)

Returns the quantum state fidelity between density matrices.

fidelity_upper_bound(operation_mx)

Get an upper bound on the fidelity of the given operation matrix with any unitary operation matrix.

frobeniusdist(a, b)

Returns the frobenius distance between arrays: ||a - b||_Fro.

frobeniusdist_squared(a, b)

Returns the square of the frobenius distance between arrays: (||a - b||_Fro)^2.

gateset_infidelity(model, target_model[, ...])

Computes the average-over-gates of the infidelity between gates in model and the gates in target_model.

generator_infidelity(a, b[, mx_basis])

Returns the generator infidelity between a and b, where b is the "target" operation.

instrument_diamonddist(a, b, mx_basis[, ...])

The diamond distance between instruments a and b.

instrument_infidelity(a, b, mx_basis)

Infidelity between instruments a and b

is_trace_preserving(a[, mx_basis, tol])

is_valid_lindblad_paramtype(typ)

Whether typ is a recognized Lindblad-gate parameterization type.

jtracedist(a, b[, mx_basis])

Compute the Jamiolkowski trace distance between operation matrices.

minimal_kraus_decomposition(op_x, op_basis)

The array op_x represents a completely positive superoperator X on Hilbert-Schmidt space, using op_basis as the basis for that space.

operation_from_error_generator(error_gen, ...)

Construct a gate from an error generator and a target gate.

povm_diamonddist(model, target_model, povmlbl)

Computes the diamond distance between POVM maps using diamonddist().

povm_fidelity(model, target_model, povmlbl)

Computes the process (entanglement) fidelity between POVM maps.

povm_jtracedist(model, target_model, povmlbl)

Computes the Jamiolkowski trace distance between POVM maps using jtracedist().

project_errorgen(errorgen, ...[, ...])

Compute the projections of a gate error generator onto a set of elementary error generators.

project_model(model, target_model[, ...])

Construct a new model(s) by projecting the error generator of model onto some sub-space then reconstructing.

project_to_target_eigenspace(model, target_model)

Project each gate of model onto the eigenspace of the corresponding gate within target_model.

relaxed_scalar_tolerance([exponent])

Temporarily lower the global __SCALAR_TOL_EXPONENT__ used by fidelity() (and any other consumer of that global) to gate NumericalDomainWarning emission.

rootconj_superop(effect_superket, basis[, ...])

Let E denote the Hermitian matrix representation effect_superket, where 0 ≤ E ≤ 1.

rotation_gate_mx(r[, mx_basis])

Construct a rotation operation matrix.

spam_error_generator(spamvec, ...[, typ])

Construct an error generator from a SPAM vector and it's target.

state_to_dmvec(psi)

Compute the vectorized density matrix which acts as the state psi.

std_process_mx_to_unitary(superop_mx)

Compute the unitary corresponding to the (unitary-action!) super-operator superop.

superket_trace(superket, basis)

superop_is_unitary(superop_mx[, mx_basis, ...])

TODO: docstring

superop_to_unitary(superop_mx[, mx_basis, ...])

TODO: docstring

tensorized_with_eye(op, op_basis[, ...])

op is a linear operator on a Hilbert-Schmidt space, S, represented as a matrix in the op_basis basis.

tracedist(a, b)

Compute the trace distance between matrices.

tracenorm(a)

Compute the trace norm of matrix a given by:

unitarity(a[, mx_basis])

Returns the "unitarity" of a channel.

unitary_to_pauligate(u)

Get the linear operator on (vectorized) density matrices corresponding to a n-qubit unitary operator on states.

unitary_to_std_process_mx(u)

Compute the superoperator corresponding to unitary matrix u.

unitary_to_superop(u[, superop_mx_basis])

TODO: docstring