pygsti.algorithms.contract

GST contraction algorithms

Module Contents

Functions

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.

_contract_to_xp(model, dataset, verbosity, method='Nelder-Mead', maxiter=100000, tol=1e-10)

_contract_to_cp(model, verbosity, method='Nelder-Mead', maxiter=100000, tol=0.01)

_contract_to_cp_direct(model, verbosity, tp_also=False, maxiter=100000, tol=1e-08)

_contract_to_tp(model, verbosity)

_contract_to_valid_spam(model, verbosity=0)

Contract the surface preparation and measurement operations of

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
  • model (Model) – The model to contract

  • to_what (string) –

    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.

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

  • maxiter (int, optional) – Maximum number of iterations for iterative contraction routines.

  • tol (float, optional) – Tolerance for iterative contraction routines.

  • use_direct_cp (bool, 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.

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

  • verbosity (int, optional) – How much detail to send to stdout.

Returns

Model – The contracted model

pygsti.algorithms.contract._contract_to_xp(model, dataset, verbosity, method='Nelder-Mead', maxiter=100000, tol=1e-10)
pygsti.algorithms.contract._contract_to_cp(model, verbosity, method='Nelder-Mead', maxiter=100000, tol=0.01)
pygsti.algorithms.contract._contract_to_cp_direct(model, verbosity, tp_also=False, maxiter=100000, tol=1e-08)
pygsti.algorithms.contract._contract_to_tp(model, verbosity)
pygsti.algorithms.contract._contract_to_valid_spam(model, verbosity=0)

Contract the surface preparation and measurement operations of a Model to the space of valid quantum operations.

Parameters
  • model (Model) – The model to contract

  • verbosity (int) – How much detail to send to stdout.

Returns

Model – The contracted model