pygsti.objects.LinearlyParameterizedGate

class pygsti.objects.LinearlyParameterizedGate(baseMatrix, parameterArray, parameterToBaseIndicesMap, leftTransform=None, rightTransform=None, real=False)

Encapsulates a gate matrix that is parameterized such that each element of the gate matrix depends only linearly on any parameter.

__init__(baseMatrix, parameterArray, parameterToBaseIndicesMap, leftTransform=None, rightTransform=None, real=False)

Initialize a LinearlyParameterizedGate object.

Parameters:
  • basematrix (numpy array) – a square 2D numpy array that acts as the starting point when constructin the gate’s matrix. The shape of this array sets the dimension of the gate.
  • parameterArray (numpy array) – a 1D numpy array that holds the all the parameters for this gate. The shape of this array sets is what is returned by value_dimension(...).
  • parameterToBaseIndicesMap (dict) – A dictionary with keys == index of a parameter (i.e. in parameterArray) and values == list of 2-tuples indexing potentially multiple gate matrix coordinates which should be set equal to this parameter.
  • leftTransform (numpy array or None, optional) – A 2D array of the same shape as basematrix which left-multiplies the base matrix after parameters have been evaluated. Defaults to no tranform.
  • rightTransform (numpy array or None, optional) – A 2D array of the same shape as basematrix which right-multiplies the base matrix after parameters have been evaluated. Defaults to no tranform.
  • real (bool, optional) – Whether or not the resulting gate matrix, after all parameter evaluation and left & right transforms have been performed, should be real. If True, ValueError will be raised if the matrix contains any complex or imaginary elements.

Methods

__init__(baseMatrix, parameterArray, ...[, ...]) Initialize a LinearlyParameterizedGate object.
compose(otherGate) Create and return a new gate that is the composition of this gate followed by otherGate, which must be another LinearlyParameterizedGate.
convert_to_matrix(M) Static method that converts a matrix-like object to a 2D numpy array.
copy()
deriv_wrt_params([wrtFilter]) Construct a matrix whose columns are the vectorized derivatives of the flattened gate matrix with respect to a single gate parameter.
from_vector(v) Initialize the gate using a vector of its parameters.
get_dimension() Return the dimension of the gate matrix.
num_params() Get the number of independent parameters which specify this gate.
set_matrix(M) Attempts to modify gate parameters so that the specified raw gate matrix becomes mx.
to_vector() Extract a vector of the underlying gate parameters from this gate.
transform(S, Si) Update gate matrix G with inv(S) * G * S,