pygsti.report.reportables

Functions which compute named quantities for Models and Datasets.

Module Contents

Classes

GateEigenvalues

Gate eigenvalues

CircuitEigenvalues

Circuit eigenvalues

CircuitHalfDiamondNorm

1/2 diamond norm of difference between productA(circuit) and productB(circuit)

HalfDiamondNorm

Half the diamond distance bewteen model_a.operations[op_label] and model_b.operations[op_label]

Functions

_null_fn(*arg)

_project_to_valid_prob(p, tol=1e-09)

_make_reportable_qty_or_dict(f0, df=None, non_markovian_ebs=False)

Just adds special processing with f0 is a dict, where we

evaluate(model_fn, cri=None, verbosity=0)

Evaluate a ModelFunction object using confidence region information

spam_dotprods(rho_vecs, povms)

SPAM dot products (concatenates POVMS)

choi_matrix(gate, mx_basis)

Choi matrix

choi_eigenvalues(gate, mx_basis)

Choi matrix eigenvalues

choi_trace(gate, mx_basis)

Trace of the Choi matrix

rel_circuit_eigenvalues(model_a, model_b, circuit)

Eigenvalues of dot(productB(circuit)^-1, productA(circuit))

circuit_frobenius_diff(model_a, model_b, circuit)

Frobenius distance btwn productA(circuit) and productB(circuit)

circuit_entanglement_infidelity(model_a, model_b, circuit)

Entanglement infidelity btwn productA(circuit) and productB(circuit)

circuit_avg_gate_infidelity(model_a, model_b, circuit)

Average gate infidelity between productA(circuit) and productB(circuit).

circuit_jtrace_diff(model_a, model_b, circuit)

Jamiolkowski trace distance between productA(circuit) and productB(circuit)

circuit_nonunitary_entanglement_infidelity(model_a, model_b, circuit)

Nonunitary entanglement infidelity between productA(circuit) and productB(circuit)

circuit_nonunitary_avg_gate_infidelity(model_a, model_b, circuit)

Nonunitary average gate infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_entanglement_infidelity(model_a, model_b, circuit)

Eigenvalue entanglement infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_avg_gate_infidelity(model_a, model_b, circuit)

Eigenvalue average gate infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_nonunitary_entanglement_infidelity(model_a, model_b, circuit)

Eigenvalue nonunitary entanglement infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_nonunitary_avg_gate_infidelity(model_a, model_b, circuit)

Eigenvalue nonunitary average gate infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_diamondnorm(model_a, model_b, circuit)

Eigenvalue diamond distance between productA(circuit) and productB(circuit).

circuit_eigenvalue_nonunitary_diamondnorm(model_a, model_b, circuit)

Eigenvalue nonunitary diamond distance between productA(circuit) and productB(circuit).

povm_entanglement_infidelity(model_a, model_b, povmlbl)

POVM entanglement infidelity between model_a and model_b.

povm_jtrace_diff(model_a, model_b, povmlbl)

POVM Jamiolkowski trace distance between model_a and model_b

povm_half_diamond_norm(model_a, model_b, povmlbl)

Half the POVM diamond distance between model_a and model_b.

decomposition(gate)

DEPRECATED: Decompose a 1Q gate into rotations about axes.

upper_bound_fidelity(gate, mx_basis)

Upper bound on entanglement fidelity

closest_ujmx(gate, mx_basis)

Jamiolkowski state of closest unitary to gate

maximum_fidelity(gate, mx_basis)

Fidelity between gate and its closest unitary

maximum_trace_dist(gate, mx_basis)

Jamiolkowski trace distance between gate and its closest unitary

angles_btwn_rotn_axes(model)

Array of angles between the rotation axes of the gates of model.

entanglement_fidelity(a, b, mx_basis)

Entanglement fidelity between a and b

entanglement_infidelity(a, b, mx_basis)

Entanglement infidelity between a and b

closest_unitary_fidelity(a, b, mx_basis)

Entanglement infidelity between closest unitaries to a and b

frobenius_diff(a, b, mx_basis)

Frobenius distance between a and b

jtrace_diff(a, b, mx_basis)

Jamiolkowski trace distance between a and b

std_unitarity(a, b, mx_basis)

a gauge-invariant quantity that behaves like the unitarity

eigenvalue_unitarity(a, b)

a gauge-invariant quantity that behaves like the unitarity

nonunitary_entanglement_infidelity(a, b, mx_basis)

Returns (d^2 - 1)/d^2 * (1 - sqrt(U)), where U is the unitarity of a*b^{-1}

nonunitary_avg_gate_infidelity(a, b, mx_basis)

Returns (d - 1)/d * (1 - sqrt(U)), where U is the unitarity of a*b^{-1}

eigenvalue_nonunitary_entanglement_infidelity(a, b, mx_basis)

Returns (d^2 - 1)/d^2 * (1 - sqrt(U)), where U is the eigenvalue-unitarity of a*b^{-1}

eigenvalue_nonunitary_avg_gate_infidelity(a, b, mx_basis)

Returns (d - 1)/d * (1 - sqrt(U)), where U is the eigenvalue-unitarity of a*b^{-1}

eigenvalue_entanglement_infidelity(a, b, mx_basis)

Eigenvalue entanglement infidelity between a and b

eigenvalue_avg_gate_infidelity(a, b, mx_basis)

Eigenvalue average gate infidelity between a and b

eigenvalue_diamondnorm(a, b, mx_basis)

Eigenvalue diamond distance between a and b

eigenvalue_nonunitary_diamondnorm(a, b, mx_basis)

Eigenvalue nonunitary diamond distance between a and b

avg_gate_infidelity(a, b, mx_basis)

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

model_model_angles_btwn_axes(a, b, mx_basis)

Angle between the rotation axes of a and b (1-qubit gates)

rel_eigenvalues(a, b, mx_basis)

Eigenvalues of b^{-1} * a

rel_log_tig_eigenvalues(a, b, mx_basis)

Eigenvalues of log(b^{-1} * a)

rel_log_gti_eigenvalues(a, b, mx_basis)

Eigenvalues of log(a * b^{-1})

rel_log_diff_eigenvalues(a, b, mx_basis)

Eigenvalues of log(a) - log(b)

rel_gate_eigenvalues(a, b, mx_basis)

Eigenvalues of b^{-1} * a

errorgen_and_projections(errgen, mx_basis)

Project errgen on all of the standard sets of error generators.

log_tig_and_projections(a, b, mx_basis)

Projections of log(b^{-1}*a).

log_gti_and_projections(a, b, mx_basis)

Projections of log(a*b^{-1}).

log_diff_and_projections(a, b, mx_basis)

Projections of log(a)-log(b).

robust_log_gti_and_projections(model_a, model_b, synthetic_idle_circuits)

Projections of log(A*B^{-1}) using a gauge-robust technique.

general_decomposition(model_a, model_b)

Decomposition of gates in model_a using those in model_b as their targets.

average_gateset_infidelity(model_a, model_b)

Average model infidelity

predicted_rb_number(model_a, model_b)

Prediction of RB number based on estimated (A) and target (B) models

vec_fidelity(a, b, mx_basis)

State fidelity between state vectors a and b

vec_infidelity(a, b, mx_basis)

State infidelity fidelity between state vectors a and b

vec_trace_diff(a, b, mx_basis)

Trace distance between state vectors a and b

vec_as_stdmx(vec, mx_basis)

State vector as a standard density matrix

vec_as_stdmx_eigenvalues(vec, mx_basis)

Eigenvalues of the density matrix corresponding to a state vector

info_of_opfn_by_name(name)

Returns a nice human-readable name and tooltip for a given gate-function abbreviation.

evaluate_opfn_by_name(name, model, target_model, op_label_or_string, confidence_region_info)

Evaluates that gate-function named by the abbreviation name.

instrument_infidelity(a, b, mx_basis)

Infidelity between instruments a and b

instrument_half_diamond_norm(a, b, mx_basis)

The diamond norm distance between instruments a and b.

evaluate_instrumentfn_by_name(name, model, target_model, inst_label, confidence_region_info)

Evaluates that instrument-function named by the abbreviation name.

Attributes

_CVXPY_AVAILABLE

FINITE_DIFF_EPS

Spam_dotprods

Choi_matrix

Choi_evals

Choi_trace

Rel_circuit_eigenvalues

Circuit_fro_diff

Circuit_entanglement_infidelity

Circuit_avg_gate_infidelity

Circuit_jt_diff

Circuit_nonunitary_entanglement_infidelity

Circuit_nonunitary_avg_gate_infidelity

Circuit_eigenvalue_entanglement_infidelity

Circuit_eigenvalue_avg_gate_infidelity

Circuit_eigenvalue_nonunitary_entanglement_infidelity

Circuit_eigenvalue_nonunitary_avg_gate_infidelity

Circuit_eigenvalue_diamondnorm

Circuit_eigenvalue_nonunitary_diamondnorm

POVM_entanglement_infidelity

POVM_jt_diff

Upper_bound_fidelity

Closest_ujmx

Maximum_fidelity

Maximum_trace_dist

Angles_btwn_rotn_axes

Entanglement_fidelity

Entanglement_infidelity

Closest_unitary_fidelity

Fro_diff

Jt_diff

Nonunitary_entanglement_infidelity

Nonunitary_avg_gate_infidelity

Eigenvalue_nonunitary_entanglement_infidelity

Eigenvalue_nonunitary_avg_gate_infidelity

Eigenvalue_entanglement_infidelity

Eigenvalue_avg_gate_infidelity

Eigenvalue_diamondnorm

Eigenvalue_nonunitary_diamondnorm

Avg_gate_infidelity

Model_model_angles_btwn_axes

Rel_eigvals

Rel_logTiG_eigvals

Rel_logGTi_eigvals

Rel_logGmlogT_eigvals

Rel_gate_eigenvalues

LogTiG_and_projections

LogGTi_and_projections

LogGmlogT_and_projections

Robust_LogGTi_and_projections

General_decomposition

Average_gateset_infidelity

Predicted_rb_number

Vec_fidelity

Vec_infidelity

Vec_tr_diff

Vec_as_stdmx

Vec_as_stdmx_eigenvalues

Instrument_infidelity

Instrument_half_diamond_norm

pygsti.report.reportables._CVXPY_AVAILABLE
pygsti.report.reportables.FINITE_DIFF_EPS = 1e-07
pygsti.report.reportables._null_fn(*arg)
pygsti.report.reportables._project_to_valid_prob(p, tol=1e-09)
pygsti.report.reportables._make_reportable_qty_or_dict(f0, df=None, non_markovian_ebs=False)

Just adds special processing with f0 is a dict, where we return a dict or ReportableQtys rather than a single ReportableQty of the dict.

pygsti.report.reportables.evaluate(model_fn, cri=None, verbosity=0)

Evaluate a ModelFunction object using confidence region information

Parameters
  • model_fn (ModelFunction) – The function to evaluate

  • cri (ConfidenceRegionFactoryView, optional) – View for computing confidence intervals.

  • verbosity (int, optional) – Amount of detail to print to stdout.

Returns

ReportableQty or dict – If model_fn does returns a dict of ReportableQty objects, otherwise a single ReportableQty.

pygsti.report.reportables.spam_dotprods(rho_vecs, povms)

SPAM dot products (concatenates POVMS)

Parameters
  • rho_vecs (list) – A list of State objects.

  • povms (list) – A list of POVM objects.

Returns

numpy.ndarray – A 2D array of shape (len(rho_vecs), num_evecs) where num_evecs is the total number of effect vectors in all of povms.

pygsti.report.reportables.Spam_dotprods
pygsti.report.reportables.choi_matrix(gate, mx_basis)

Choi matrix

Parameters
  • gate (numpy.ndarray) – the transfer-matrix specifying a gate’s action.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that gate is in.

Returns

numpy.ndarray

pygsti.report.reportables.Choi_matrix
pygsti.report.reportables.choi_eigenvalues(gate, mx_basis)

Choi matrix eigenvalues

Parameters
  • gate (numpy.ndarray) – the transfer-matrix specifying a gate’s action.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that gate is in.

Returns

numpy.ndarray

pygsti.report.reportables.Choi_evals
pygsti.report.reportables.choi_trace(gate, mx_basis)

Trace of the Choi matrix

Parameters
  • gate (numpy.ndarray) – the transfer-matrix specifying a gate’s action.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that gate is in.

Returns

float

pygsti.report.reportables.Choi_trace
class pygsti.report.reportables.GateEigenvalues(model, oplabel)

Bases: pygsti.report.modelfunction.ModelFunction

Gate eigenvalues

Parameters
  • model (Model) – Model gate is contained within.

  • oplabel (Label) – The gate’s label within model.

evaluate(self, model)

Evaluate at model

Parameters

model (Model) – A model nearby in parameter space.

Returns

numpy.ndarray

evaluate_nearby(self, nearby_model)

Evaluate at a nearby model

Parameters

nearby_model (Model) – A model nearby in parameter space.

Returns

numpy.ndarray

class pygsti.report.reportables.CircuitEigenvalues(model, circuit)

Bases: pygsti.report.modelfunction.ModelFunction

Circuit eigenvalues

Parameters
  • model (Model) – Model used to evaluate circuit.

  • circuit (Circuit) – The circuit whose process matrix we want the eigenvalues of.

evaluate(self, model)

Evaluate at model

Parameters

model (Model) – Model to evaluate at.

Returns

numpy.ndarray

evaluate_nearby(self, nearby_model)

Evaluate at nearby model

Parameters

nearby_model (Model) – A model nearby in parameter space.

Returns

numpy.ndarray

pygsti.report.reportables.rel_circuit_eigenvalues(model_a, model_b, circuit)

Eigenvalues of dot(productB(circuit)^-1, productA(circuit))

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

numpy.ndarray

pygsti.report.reportables.Rel_circuit_eigenvalues
pygsti.report.reportables.circuit_frobenius_diff(model_a, model_b, circuit)

Frobenius distance btwn productA(circuit) and productB(circuit)

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_fro_diff
pygsti.report.reportables.circuit_entanglement_infidelity(model_a, model_b, circuit)

Entanglement infidelity btwn productA(circuit) and productB(circuit)

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_entanglement_infidelity
pygsti.report.reportables.circuit_avg_gate_infidelity(model_a, model_b, circuit)

Average gate infidelity between productA(circuit) and productB(circuit).

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_avg_gate_infidelity
pygsti.report.reportables.circuit_jtrace_diff(model_a, model_b, circuit)

Jamiolkowski trace distance between productA(circuit) and productB(circuit)

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_jt_diff
class pygsti.report.reportables.CircuitHalfDiamondNorm(model_a, model_b, circuit)

Bases: pygsti.report.modelfunction.ModelFunction

1/2 diamond norm of difference between productA(circuit) and productB(circuit)

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

evaluate(self, model)

Evaluate this function at model

Parameters

model (Model) – Model to evaluate at.

Returns

float

evaluate_nearby(self, nearby_model)

Evaluate at a nearby model

Parameters

nearby_model (Model) – A model nearby in parameter space.

Returns

float

pygsti.report.reportables.circuit_nonunitary_entanglement_infidelity(model_a, model_b, circuit)

Nonunitary entanglement infidelity between productA(circuit) and productB(circuit)

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_nonunitary_entanglement_infidelity
pygsti.report.reportables.circuit_nonunitary_avg_gate_infidelity(model_a, model_b, circuit)

Nonunitary average gate infidelity between productA(circuit) and productB(circuit).

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_nonunitary_avg_gate_infidelity
pygsti.report.reportables.circuit_eigenvalue_entanglement_infidelity(model_a, model_b, circuit)

Eigenvalue entanglement infidelity between productA(circuit) and productB(circuit).

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_eigenvalue_entanglement_infidelity
pygsti.report.reportables.circuit_eigenvalue_avg_gate_infidelity(model_a, model_b, circuit)

Eigenvalue average gate infidelity between productA(circuit) and productB(circuit).

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_eigenvalue_avg_gate_infidelity
pygsti.report.reportables.circuit_eigenvalue_nonunitary_entanglement_infidelity(model_a, model_b, circuit)

Eigenvalue nonunitary entanglement infidelity between productA(circuit) and productB(circuit).

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_eigenvalue_nonunitary_entanglement_infidelity
pygsti.report.reportables.circuit_eigenvalue_nonunitary_avg_gate_infidelity(model_a, model_b, circuit)

Eigenvalue nonunitary average gate infidelity between productA(circuit) and productB(circuit).

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_eigenvalue_nonunitary_avg_gate_infidelity
pygsti.report.reportables.circuit_eigenvalue_diamondnorm(model_a, model_b, circuit)

Eigenvalue diamond distance between productA(circuit) and productB(circuit).

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_eigenvalue_diamondnorm
pygsti.report.reportables.circuit_eigenvalue_nonunitary_diamondnorm(model_a, model_b, circuit)

Eigenvalue nonunitary diamond distance between productA(circuit) and productB(circuit).

Parameters
  • model_a (Model) – The first model (to evaluate productA)

  • model_b (Model) – The second model (to evaluate productB)

  • circuit (Circuit) – The circuit.

Returns

float

pygsti.report.reportables.Circuit_eigenvalue_nonunitary_diamondnorm
pygsti.report.reportables.povm_entanglement_infidelity(model_a, model_b, povmlbl)

POVM entanglement infidelity between model_a and model_b.

Equal to 1 - entanglement_fidelity(POVM_MAP) where POVM_MAP is the extension of the POVM from the classical space of k-outcomes to the space of (diagonal) k by k density matrices.

Parameters
  • model_a (Model) – The first model.

  • model_b (Model) – The second model.

  • povmlbl (Label) – The POVM label (must be present in both models).

Returns

float

pygsti.report.reportables.POVM_entanglement_infidelity
pygsti.report.reportables.povm_jtrace_diff(model_a, model_b, povmlbl)

POVM Jamiolkowski trace distance between model_a and model_b

Equal to Jamiolkowski_trace_distance(POVM_MAP) where POVM_MAP is the extension of the POVM from the classical space of k-outcomes to the space of (diagonal) k by k density matrices.

Parameters
  • model_a (Model) – The first model.

  • model_b (Model) – The second model.

  • povmlbl (Label) – The POVM label (must be present in both models).

Returns

float

pygsti.report.reportables.POVM_jt_diff
pygsti.report.reportables.povm_half_diamond_norm(model_a, model_b, povmlbl)

Half the POVM diamond distance between model_a and model_b.

Equal to half_diamond_dist(POVM_MAP) where POVM_MAP is the extension of the POVM from the classical space of k-outcomes to the space of (diagonal) k by k density matrices.

Parameters
  • model_a (Model) – The first model.

  • model_b (Model) – The second model.

  • povmlbl (Label) – The POVM label (must be present in both models).

Returns

float

pygsti.report.reportables.decomposition(gate)

DEPRECATED: Decompose a 1Q gate into rotations about axes.

Parameters

gate (numpy.ndarray) – the transfer-matrix specifying a gate’s action.

Returns

ReportableQty

pygsti.report.reportables.upper_bound_fidelity(gate, mx_basis)

Upper bound on entanglement fidelity

Parameters
  • gate (numpy.ndarray) – the transfer-matrix specifying a gate’s action.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that gate is in.

Returns

float

pygsti.report.reportables.Upper_bound_fidelity
pygsti.report.reportables.closest_ujmx(gate, mx_basis)

Jamiolkowski state of closest unitary to gate

Parameters
  • gate (numpy.ndarray) – the transfer-matrix specifying a gate’s action.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that gate is in.

Returns

float

pygsti.report.reportables.Closest_ujmx
pygsti.report.reportables.maximum_fidelity(gate, mx_basis)

Fidelity between gate and its closest unitary

Parameters
  • gate (numpy.ndarray) – the transfer-matrix specifying a gate’s action.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that gate is in.

Returns

float

pygsti.report.reportables.Maximum_fidelity
pygsti.report.reportables.maximum_trace_dist(gate, mx_basis)

Jamiolkowski trace distance between gate and its closest unitary

Parameters
  • gate (numpy.ndarray) – the transfer-matrix specifying a gate’s action.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that gate is in.

Returns

float

pygsti.report.reportables.Maximum_trace_dist
pygsti.report.reportables.angles_btwn_rotn_axes(model)

Array of angles between the rotation axes of the gates of model.

Parameters

model (Model) – The model to process.

Returns

numpy.ndarray – Of size (nOperations,nGate) where nOperations=len(model.operations)

pygsti.report.reportables.Angles_btwn_rotn_axes
pygsti.report.reportables.entanglement_fidelity(a, b, mx_basis)

Entanglement fidelity between a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Entanglement_fidelity
pygsti.report.reportables.entanglement_infidelity(a, b, mx_basis)

Entanglement infidelity between a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Entanglement_infidelity
pygsti.report.reportables.closest_unitary_fidelity(a, b, mx_basis)

Entanglement infidelity between closest unitaries to a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Closest_unitary_fidelity
pygsti.report.reportables.frobenius_diff(a, b, mx_basis)

Frobenius distance between a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Fro_diff
pygsti.report.reportables.jtrace_diff(a, b, mx_basis)

Jamiolkowski trace distance between a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Jt_diff
class pygsti.report.reportables.HalfDiamondNorm(model_a, model_b, oplabel)

Bases: pygsti.report.modelfunction.ModelFunction

Half the diamond distance bewteen model_a.operations[op_label] and model_b.operations[op_label]

Parameters
  • model_a (Model) – The first model.

  • model_b (Model) – The second model.

  • oplabel (Label) – The operation (gate) label to compare.

evaluate(self, model)

Evaluate at model_a = model

Parameters

model (Model) – Model to evaluate at.

Returns

float

evaluate_nearby(self, nearby_model)

Evaluates at a nearby model

Parameters

nearby_model (Model) – A model nearby in parameter space.

Returns

float

pygsti.report.reportables.std_unitarity(a, b, mx_basis)

a gauge-invariant quantity that behaves like the unitarity

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.eigenvalue_unitarity(a, b)

a gauge-invariant quantity that behaves like the unitarity

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

Returns

float

pygsti.report.reportables.nonunitary_entanglement_infidelity(a, b, mx_basis)

Returns (d^2 - 1)/d^2 * (1 - sqrt(U)), where U is the unitarity of a*b^{-1}

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Nonunitary_entanglement_infidelity
pygsti.report.reportables.nonunitary_avg_gate_infidelity(a, b, mx_basis)

Returns (d - 1)/d * (1 - sqrt(U)), where U is the unitarity of a*b^{-1}

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Nonunitary_avg_gate_infidelity
pygsti.report.reportables.eigenvalue_nonunitary_entanglement_infidelity(a, b, mx_basis)

Returns (d^2 - 1)/d^2 * (1 - sqrt(U)), where U is the eigenvalue-unitarity of a*b^{-1}

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Eigenvalue_nonunitary_entanglement_infidelity
pygsti.report.reportables.eigenvalue_nonunitary_avg_gate_infidelity(a, b, mx_basis)

Returns (d - 1)/d * (1 - sqrt(U)), where U is the eigenvalue-unitarity of a*b^{-1}

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Eigenvalue_nonunitary_avg_gate_infidelity
pygsti.report.reportables.eigenvalue_entanglement_infidelity(a, b, mx_basis)

Eigenvalue entanglement infidelity between a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Eigenvalue_entanglement_infidelity
pygsti.report.reportables.eigenvalue_avg_gate_infidelity(a, b, mx_basis)

Eigenvalue average gate infidelity between a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Eigenvalue_avg_gate_infidelity
pygsti.report.reportables.eigenvalue_diamondnorm(a, b, mx_basis)

Eigenvalue diamond distance between a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Eigenvalue_diamondnorm
pygsti.report.reportables.eigenvalue_nonunitary_diamondnorm(a, b, mx_basis)

Eigenvalue nonunitary diamond distance between a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Eigenvalue_nonunitary_diamondnorm
pygsti.report.reportables.avg_gate_infidelity(a, b, mx_basis)

Returns the average gate infidelity between a and b, where b is the “target” operation.

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Avg_gate_infidelity
pygsti.report.reportables.model_model_angles_btwn_axes(a, b, mx_basis)

Angle between the rotation axes of a and b (1-qubit gates)

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Model_model_angles_btwn_axes
pygsti.report.reportables.rel_eigenvalues(a, b, mx_basis)

Eigenvalues of b^{-1} * a

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.reportables.Rel_eigvals
pygsti.report.reportables.rel_log_tig_eigenvalues(a, b, mx_basis)

Eigenvalues of log(b^{-1} * a)

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.reportables.Rel_logTiG_eigvals
pygsti.report.reportables.rel_log_gti_eigenvalues(a, b, mx_basis)

Eigenvalues of log(a * b^{-1})

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.reportables.Rel_logGTi_eigvals
pygsti.report.reportables.rel_log_diff_eigenvalues(a, b, mx_basis)

Eigenvalues of log(a) - log(b)

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.reportables.Rel_logGmlogT_eigvals
pygsti.report.reportables.rel_gate_eigenvalues(a, b, mx_basis)

Eigenvalues of b^{-1} * a

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.reportables.Rel_gate_eigenvalues
pygsti.report.reportables.errorgen_and_projections(errgen, mx_basis)

Project errgen on all of the standard sets of error generators.

Parameters
  • errgen (numpy.ndarray) – The error generator.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that errgen is in.

Returns

dict – Dictionary of ‘error generator’, ‘X projections’, and ‘X projection power’ keys, where X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.reportables.log_tig_and_projections(a, b, mx_basis)

Projections of log(b^{-1}*a).

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

dict – A dictionary of quantities with keys ‘error generator’, ‘X projections’, and ‘X projection power’, where X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.reportables.LogTiG_and_projections
pygsti.report.reportables.log_gti_and_projections(a, b, mx_basis)

Projections of log(a*b^{-1}).

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

dict – A dictionary of quantities with keys ‘error generator’, ‘X projections’, and ‘X projection power’, where X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.reportables.LogGTi_and_projections
pygsti.report.reportables.log_diff_and_projections(a, b, mx_basis)

Projections of log(a)-log(b).

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

dict – A dictionary of quantities with keys ‘error generator’, ‘X projections’, and ‘X projection power’, where X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.reportables.LogGmlogT_and_projections
pygsti.report.reportables.robust_log_gti_and_projections(model_a, model_b, synthetic_idle_circuits)

Projections of log(A*B^{-1}) using a gauge-robust technique.

Parameters
  • model_a (Model) – The first model (A gates).

  • model_b (Model) – The second model (B gates).

  • synthetic_idle_circuits (list) – Circuits that encode synthetic idles.

Returns

dict – A dictionary of quantities with keys ‘G error generator’, ‘G X projections’, and ‘G X projection power’, where G is a operation label and X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.reportables.Robust_LogGTi_and_projections
pygsti.report.reportables.general_decomposition(model_a, model_b)

Decomposition of gates in model_a using those in model_b as their targets.

This function uses a generalized decomposition algorithm that can gates acting on a Hilbert space of any dimension.

Parameters
  • model_a (Model) – The model.

  • model_b (Model) – The target model.

Returns

dict

pygsti.report.reportables.General_decomposition
pygsti.report.reportables.average_gateset_infidelity(model_a, model_b)

Average model infidelity

Parameters
  • model_a (Model) – The first model.

  • model_b (Model) – The second model.

Returns

float

pygsti.report.reportables.Average_gateset_infidelity
pygsti.report.reportables.predicted_rb_number(model_a, model_b)

Prediction of RB number based on estimated (A) and target (B) models

Parameters
  • model_a (Model) – The first model.

  • model_b (Model) – The second model.

Returns

float

pygsti.report.reportables.Predicted_rb_number
pygsti.report.reportables.vec_fidelity(a, b, mx_basis)

State fidelity between state vectors a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Vec_fidelity
pygsti.report.reportables.vec_infidelity(a, b, mx_basis)

State infidelity fidelity between state vectors a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Vec_infidelity
pygsti.report.reportables.vec_trace_diff(a, b, mx_basis)

Trace distance between state vectors a and b

Parameters
  • a (numpy.ndarray) – The first process (transfer) matrix.

  • b (numpy.ndarray) – The second process (transfer) matrix.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Vec_tr_diff
pygsti.report.reportables.vec_as_stdmx(vec, mx_basis)

State vector as a standard density matrix

Parameters
  • vec (numpy.ndarray) – state vector as a 1D dense array.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that vec is in.

Returns

numpy.ndarray – A 2D array (matrix) that is vec in the standard basis.

pygsti.report.reportables.Vec_as_stdmx
pygsti.report.reportables.vec_as_stdmx_eigenvalues(vec, mx_basis)

Eigenvalues of the density matrix corresponding to a state vector

Parameters
  • vec (numpy.ndarray) – state vector as a 1D dense array.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that vec is in.

Returns

numpy.ndarray

pygsti.report.reportables.Vec_as_stdmx_eigenvalues
pygsti.report.reportables.info_of_opfn_by_name(name)

Returns a nice human-readable name and tooltip for a given gate-function abbreviation.

Parameters

name (str) –

An appreviation for a gate-function name. Allowed values are:

  • ”inf” : entanglement infidelity

  • ”agi” : average gate infidelity

  • ”trace” : 1/2 trace distance

  • ”diamond” : 1/2 diamond norm distance

  • ”nuinf” : non-unitary entanglement infidelity

  • ”nuagi” : non-unitary entanglement infidelity

  • ”evinf” : eigenvalue entanglement infidelity

  • ”evagi” : eigenvalue average gate infidelity

  • ”evnuinf” : eigenvalue non-unitary entanglement infidelity

  • ”evnuagi” : eigenvalue non-unitary entanglement infidelity

  • ”evdiamond” : eigenvalue 1/2 diamond norm distance

  • ”evnudiamond” : eigenvalue non-unitary 1/2 diamond norm distance

  • ”frob” : frobenius distance

  • ”unmodeled” : unmodeled “wildcard” budget

Returns

  • nicename (str)

  • tooltip (str)

pygsti.report.reportables.evaluate_opfn_by_name(name, model, target_model, op_label_or_string, confidence_region_info)

Evaluates that gate-function named by the abbreviation name.

Parameters
  • name (str) – An appreviation for a operation-function name. Allowed values are the same as those of info_of_opfn_by_name().

  • model (Model) – The model used by the operation-function.

  • target_model (Model) – The target model.

  • op_label_or_string (str or Circuit or tuple) – The operation label or sequence of labels to compare. If a sequence of labels is given, then the “virtual gate” computed by taking the product of the specified gate matrices is compared.

  • confidence_region_info (ConfidenceRegion, optional) – If not None, specifies a confidence-region used to compute error intervals.

Returns

ReportableQty

pygsti.report.reportables.instrument_infidelity(a, b, mx_basis)

Infidelity between instruments a and b

Parameters
  • a (Instrument) – The first instrument.

  • b (Instrument) – The second instrument.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Instrument_infidelity
pygsti.report.reportables.instrument_half_diamond_norm(a, b, mx_basis)

The diamond norm distance between instruments a and b.

Parameters
  • a (Instrument) – The first instrument.

  • b (Instrument) – The second instrument.

  • mx_basis (Basis or {'pp', 'gm', 'std'}) – the basis that a and b are in.

Returns

float

pygsti.report.reportables.Instrument_half_diamond_norm
pygsti.report.reportables.evaluate_instrumentfn_by_name(name, model, target_model, inst_label, confidence_region_info)

Evaluates that instrument-function named by the abbreviation name.

Parameters
  • name (str) – An appreviation for a operation-function name. Allowed values are the same as those of info_of_opfn_by_name().

  • model (Model) – The model used by the operation-function.

  • target_model (Model) – The target model.

  • inst_label (Label) – The instrument label to compare.

  • confidence_region_info (ConfidenceRegion, optional) – If not None, specifies a confidence-region used to compute error intervals.

Returns

ReportableQty