pygsti.modelmembers.term.RankOnePolynomialPrepTermWithMagnitude#
- class RankOnePolynomialPrepTermWithMagnitude(rep, evotype)#
Bases:
RankOnePrepTermWithMagnitude,_HasPolynomialCoefficientA state preparation term with polynomial coefficient and magnitude tracking.
Methods
__init__(rep, evotype)compose(all_terms, magnitude)Compose all_terms and set the composed term's magnitude to magnitude.
copy()Copies this term.
embed(state_space, target_labels)Embeds this term's action as a part of a larger state space.
map_indices_inplace(mapfn)Performs a bulk find & replace on the coefficient polynomial's variable indices.
mapvec_indices_inplace(mapvec)Performs a bulk find & replace on this polynomial's variable indices.
torep()Access to the underlying representation object.
Attributes
The term's coefficient (a
Polynomial).The logarithm of this term's magnitude (held separately for performance).
This term's magnitude.
- compose(all_terms, magnitude)#
Compose all_terms and set the composed term’s magnitude to magnitude.
- Parameters:
all_terms (list) – List of the terms to compose.
magnitude (float) – The magnitude of the composed term.
- Return type:
- copy()#
Copies this term.
- Return type:
- embed(state_space, target_labels)#
Embeds this term’s action as a part of a larger state space.
- Parameters:
state_space (StateSpace) – The full state space this term’s action will be embedded into.
target_labels (tuple) – A tuple of the target labels.
- Return type:
- map_indices_inplace(mapfn)#
Performs a bulk find & replace on the coefficient polynomial’s variable indices.
This function should only be called when this term’s coefficient is a
Polynomial.- Parameters:
mapfn (function) – A function that takes as input an “old” variable-index-tuple (a key of this Polynomial) and returns the updated “new” variable-index-tuple.
- Return type:
None
- mapvec_indices_inplace(mapvec)#
Performs a bulk find & replace on this polynomial’s variable indices.
This function is similar to
map_indices()but uses a vector to describe individual index updates instead of a function for increased performance.This function should only be called when this term’s coefficient is a
Polynomial.- Parameters:
mapvec (numpy.ndarray) – An array whose i-th element gives the updated “new” index for the i-th variable. Note that this vector maps individual variable indices old->new, whereas mapfn in
map_indices()maps between tuples of indices.- Return type:
None
- torep()#
Access to the underlying representation object.
- property coeff#
The term’s coefficient (a
Polynomial).
- property logmagnitude#
The logarithm of this term’s magnitude (held separately for performance).
- property magnitude#
This term’s magnitude.