pygsti.modelmembers.povms.computationaleffect
The ComputationalBasisPOVMEffect class and supporting functionality.
Module Contents
Classes
A static POVM effect that is tensor product of 1-qubit Z-eigenstates. |
- class pygsti.modelmembers.povms.computationaleffect.ComputationalBasisPOVMEffect(zvals, basis='pp', evotype='default', state_space=None)
Bases:
pygsti.modelmembers.povms.effect.POVMEffect
A static POVM effect that is tensor product of 1-qubit Z-eigenstates.
This is called a “computational basis state” in many contexts.
Parameters
- zvalsiterable
A list or other iterable of integer 0 or 1 outcomes specifying which computational basis element this object represents. The length of zvals gives the total number of qubits.
- basisBasis or {‘pp’,’gm’,’std’}, optional
The basis used to construct the Hilbert-Schmidt space representation of this state as a super-ket.
- 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 POVM effect Vector
- property num_params
Get the number of independent parameters which specify this POVM effect vector.
Returns
- int
the number of independent parameters.
- classmethod from_state_vector(vec, basis='pp', evotype='default', state_space=None)
Create a new ComputationalBasisPOVMEffect from a dense vector.
Parameters
- vecnumpy.ndarray
A state vector specifying a computational basis state in the standard basis. This vector has length 4^n for n qubits.
- basisBasis or {‘pp’,’gm’,’std’}, optional
The basis of vec as a super-ket.
- evotypeEvotype or str, optional
The evolution type of the resulting effect vector. 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.
Returns
ComputationalBasisPOVMEffect
- classmethod from_pure_vector(purevec, basis='pp', evotype='default', state_space=None)
TODO: update docstring Create a new StabilizerEffectVec from a pure-state vector.
Currently, purevec must be a single computational basis state (it cannot be a superpostion of multiple of them).
Parameters
- purevecnumpy.ndarray
A complex-valued state vector specifying a pure state in the standard computational basis. This vector has length 2^n for n qubits.
- basisBasis or {‘pp’,’gm’,’std’}, optional
The basis of vec as a super-ket.
- evotypeEvotype or str, optional
The evolution type of the resulting effect vector. 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.
Returns
ComputationalBasisPOVMEffect
- to_memoized_dict(mmg_memo)
Create a serializable dict with references to other objects in the memo.
Parameters
- 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.).
Returns
- 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.
- to_dense(on_space='minimal', scratch=None)
Return this POVM effect vector as a (dense) numpy array.
The memory in scratch maybe used when it is not-None.
Parameters
- on_space{‘minimal’, ‘Hilbert’, ‘HilbertSchmidt’}
The space that the returned dense operation acts upon. For unitary matrices and bra/ket vectors, use ‘Hilbert’. For superoperator matrices and super-bra/super-ket vectors use ‘HilbertSchmidt’. ‘minimal’ means that ‘Hilbert’ is used if possible given this operator’s evolution type, and otherwise ‘HilbertSchmidt’ is used.
- scratchnumpy.ndarray, optional
scratch space available for use.
Returns
numpy.ndarray
- taylor_order_terms(order, max_polynomial_vars=100, return_coeff_polys=False)
Get the order-th order Taylor-expansion terms of this POVM effect vector.
This function either constructs or returns a cached list of the terms at the given order. Each term is “rank-1”, meaning that it is a state preparation followed by or POVM effect preceded by actions on a density matrix rho of the form:
rho -> A rho B
The coefficients of these terms are typically polynomials of the POVMEffect’s parameters, where the polynomial’s variable indices index the global parameters of the POVMEffect’s parent (usually a
Model
) , not the POVMEffect’s local parameter array (i.e. that returned from to_vector).Parameters
- orderint
The order of terms to get.
- max_polynomial_varsint, optional
maximum number of variables the created polynomials can have.
- return_coeff_polysbool
Whether a parallel list of locally-indexed (using variable indices corresponding to this object’s parameters rather than its parent’s) polynomial coefficients should be returned as well.
Returns
- termslist
A list of
RankOneTerm
objects.- coefficientslist
Only present when return_coeff_polys == True. A list of compact polynomial objects, meaning that each element is a (vtape,ctape) 2-tuple formed by concatenating together the output of
Polynomial.compact()
.
- to_vector()
Get the POVM effect vector parameters as an array of values.
Returns
- numpy array
The parameters as a 1D array with length num_params().
- from_vector(v, close=False, dirty_value=True)
Initialize the POVM effect vector using a 1D array of parameters.
Parameters
- vnumpy array
The 1D vector of POVM effect vector parameters. Length must == num_params()
- closebool, optional
Whether v is close to this POVM effect vector’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.
Returns
None