pygsti.construction.build_gate

pygsti.construction.build_gate(stateSpaceDims, stateSpaceLabels, gateExpr, basis='gm', parameterization='full', unitaryEmbedding=False)

Build a Gate object from an expression.

Parameters:
  • stateSpaceDims (list of ints) – Dimenstions specifying the structure of the density-matrix space. Elements correspond to block dimensions of an allowed density matrix in the standard basis, and the density-matrix space is the direct sum of linear spaces of dimension block-dimension^2.
  • stateSpaceLabels (a list of tuples) – Each tuple corresponds to a block of a density matrix in the standard basis (and therefore a component of the direct-sum density matrix space). Elements of a tuple are user-defined labels beginning with “L” (single level) or “Q” (two-level; qubit) which interpret the d-dimensional state space corresponding to a d x d block as a tensor product between qubit and single level systems.
  • gateExpr (string) –

    expression for the gate to build. String is first split into parts delimited by the colon (:) character, which are composed together to create the final gate. Each part takes on of the allowed forms:

    • I(ssl_0, ...) = identity operation on one or more state space labels (ssl_i)
    • X(theta, ssl) = x-rotation by theta radians of qubit labeled by ssl
    • Y(theta, ssl) = y-rotation by theta radians of qubit labeled by ssl
    • Z(theta, ssl) = z-rotation by theta radians of qubit labeled by ssl
    • CX(theta, ssl0, ssl1) = controlled x-rotation by theta radians.
      Acts on qubit labeled by ssl1 with ssl0 being the control.
    • CY(theta, ssl0, ssl1) = controlled y-rotation by theta radians.
      Acts on qubit labeled by ssl1 with ssl0 being the control.
    • CZ(theta, ssl0, ssl1) = controlled z-rotation by theta radians.
      Acts on qubit labeled by ssl1 with ssl0 being the control.
    • LX(theta, i0, i1) = leakage between states i0 and i1.
      Implemented as an x-rotation between states with integer indices i0 and i1 followed by complete decoherence between the states.
  • basis ({‘gm’,’pp’,’std’}, optional) –

    the basis of the returned gate.

    • “std” = gate matrix operates on density mx expressed as sum of matrix units
    • “gm” = gate matrix operates on dentity mx expressed as sum of normalized Gell-Mann matrices
    • “pp” = gate matrix operates on density mx expresses as sum of tensor-product of Pauli matrices
  • parameterization ({“full”,”TP”,”static”,”linear”}, optional) –

    How to parameterize the resulting gate.

    • “full” = return a FullyParameterizedGate.
    • “TP” = return a TPParameterizedGate.
    • “static” = return a StaticGate.
    • “linear” = if possible, return a LinearlyParameterizedGate that parameterizes , only the pieces explicitly present in gateExpr.
  • unitaryEmbedding (bool, optional) – An interal switch determining how the gate is constructed. Should have no bearing on the output except in determining how to parameterize a non-FullyParameterizedGate. It’s best to leave this to False unless you really know what you’re doing. Currently, only works for parameterization == ‘full’.
Returns:

A gate object representing the gate given by gateExpr in the desired basis.

Return type:

Gate