The EigenvalueParamDenseOp class and supporting functionality.

Module Contents



A real operation matrix parameterized only by its eigenvalues.



pygsti.modelmembers.operations.eigpdenseop.IMAG_TOL = '1e-07'
class pygsti.modelmembers.operations.eigpdenseop.EigenvalueParamDenseOp(matrix, include_off_diags_in_degen_blocks=False, tp_constrained_and_unital=False, basis=None, evotype='default', state_space=None)

Bases: pygsti.modelmembers.operations.denseop.DenseOperator

A real operation matrix parameterized only by its eigenvalues.

These eigenvalues are assumed to be either real or to occur in conjugate pairs. Thus, the number of parameters is equal to the number of eigenvalues.


matrixnumpy array

a square 2D numpy array that gives the raw operation matrix to paramterize. The shape of this array sets the dimension of the operation.

include_off_diags_in_degen_blocksbool or int

If True, include as parameters the (initially zero) off-diagonal elements in degenerate blocks of the the diagonalized operation matrix. If an integer, no off-diagonals are included in blocks larger than n x n, where n == include_off_diags_in_degen_blocks. This is an option specifically used in the per-germ-power fiducial pair reduction (FPR) algorithm.


If True, assume the top row of the operation matrix is fixed to [1, 0, … 0] and should not be parameterized, and verify that the matrix is unital. In this case, “1” is always a fixed (not-paramterized) eigenvalue with eigenvector [1,…0] and if include_off_diags_in_degen_blocks is True any off diagonal elements lying on the top row are not parameterized as implied by the TP constraint.

basisBasis or {‘pp’,’gm’,’std’} or None

The basis used to construct the Hilbert-Schmidt space representation of this state as a super-operator. If None, certain functionality, such as access to Kraus operators, will be unavailable.

evotypeEvotype or str, optional

The evolution type. The special value “default” is equivalent to specifying the value of pygsti.evotypes.Evotype.default_evotype.

state_spaceStateSpace, optional

The state space for this operation. If None a default state space with the appropriate number of qubits is used.

Initialize a new LinearOperator

property num_params

Get the number of independent parameters which specify this operation.


the number of independent parameters.


Create a serializable dict with references to other objects in the memo.

mmg_memo: dict

Memo dict from a ModelMemberGraph, i.e. keys are object ids and values are ModelMemberGraphNodes (which contain the serialize_id). This is NOT the same as other memos in ModelMember (e.g. copy, allocate_gpindices, etc.).

mm_dict: dict

A dict representation of this ModelMember ready for serialization This must have at least the following fields: module, class, submembers, params, state_space, evotype Additional fields may be added by derived classes.


Extract a vector of the underlying operation parameters from this operation.

numpy array

a 1D numpy array with length == num_params().

from_vector(v, close=False, dirty_value=True)

Initialize the operation using a vector of parameters.

vnumpy array

The 1D vector of operation parameters. Length must == num_params()

closebool, optional

Whether v is close to this operation’s current set of parameters. Under some circumstances, when this is true this call can be completed more quickly.

dirty_valuebool, optional

The value to set this object’s “dirty flag” to before exiting this call. This is passed as an argument so it can be updated recursively. Leave this set to True unless you know what you’re doing.




The element-wise derivative this operation.

Construct a matrix whose columns are the vectorized derivatives of the flattened operation matrix with respect to a single operation parameter. Thus, each column is of length op_dim^2 and there is one column per operation parameter.

wrt_filterlist or numpy.ndarray

List of parameter indices to take derivative with respect to. (None means to use all the this operation’s parameters.)

numpy array

Array of derivatives, shape == (dimension^2, num_params)


Whether this operation has a non-zero Hessian with respect to its parameters.

(i.e. whether it only depends linearly on its parameters or not)