pygsti.algorithms.contract

GST contraction algorithms

Module Contents

Functions

contract(model, to_what[, dataset, maxiter, tol, ...])

Contract a Model to a specified space.

pygsti.algorithms.contract.contract(model, to_what, dataset=None, maxiter=1000000, tol=0.01, use_direct_cp=True, method='Nelder-Mead', verbosity=0)

Contract a Model to a specified space.

All contraction operations except ‘vSPAM’ operate entirely on the gate matrices and leave state preparations and measurments alone, while ‘vSPAM’ operations only on SPAM.

Parameters

modelModel

The model to contract

to_whatstring

Specifies which space is the model is contracted to. Allowed values are:

  • ‘TP’ – All gates are manifestly trace-preserving maps.

  • ‘CP’ – All gates are manifestly completely-positive maps.

  • ‘CPTP’ – All gates are manifestly completely-positive and trace-preserving maps.

  • ‘XP’ – All gates are manifestly “experimentally-positive” maps.

  • ‘XPTP’ – All gates are manifestly “experimentally-positive” and trace-preserving maps.

  • ‘vSPAM’ – state preparation and measurement operations are valid.

  • ‘nothing’ – no contraction is performed.

datasetDataSet, optional

Dataset to use to determine whether a model is in the “experimentally-positive” (XP) space. Required only when contracting to XP or XPTP.

maxiterint, optional

Maximum number of iterations for iterative contraction routines.

tolfloat, optional

Tolerance for iterative contraction routines.

use_direct_cpbool, optional

Whether to use a faster direct-contraction method for CP contraction. This method essentially transforms to the Choi matrix, truncates any negative eigenvalues to zero, then transforms back to a operation matrix.

methodstring, optional

The method used when contracting to XP and non-directly to CP (i.e. use_direct_cp == False).

verbosityint, optional

How much detail to send to stdout.

Returns

Model

The contracted model