pygsti.modelmembers.term.RankOnePolynomialPrepTerm#

class RankOnePolynomialPrepTerm(rep, evotype)#

Bases: RankOnePrepTerm, _HasPolynomialCoefficient

A state preparation term with polynomial coefficient.

Methods

__init__(rep, evotype)

compose(all_terms)

Compose all_terms and set the composed term's magnitude to magnitude.

copy()

Copies this term.

copy_with_magnitude(mag)

Copy and set the magnitude of the copy to mag

create_from(coeff, pre_state, post_state, ...)

Creates a RankOnePrepTerm using natural arguments.

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

coeff

The term's coefficient (a Polynomial).

compose(all_terms)#

Compose all_terms and set the composed term’s magnitude to magnitude.

Parameters:

all_terms (list) – List of the terms to compose.

Return type:

RankOneTerm

copy()#

Copies this term.

Return type:

RankOneTerm

copy_with_magnitude(mag)#

Copy and set the magnitude of the copy to mag

Parameters:

mag (float) – Magnitude to set.

Return type:

RankOnePolynomialPrepTermWithMagnitude

classmethod create_from(coeff, pre_state, post_state, evotype, state_space)#

Creates a RankOnePrepTerm using natural arguments.

Parameters:
  • coeff (Polynomial or complex) – The term’s coefficient.

  • pre_state (State or StateRep or numpy.ndarray) – The ‘ket’ (left-side) state of the operator.

  • post_state (State or StateRep or numpy.ndarray) – The ‘bra’ (right-side) state of the operator

  • evotype (Evotype or str) – The evolution type

  • state_space (StateSpace or str) – The state space of this term.

Return type:

RankOnePrepTerm

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:

RankOnePrepTerm

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).