|View source on GitHub|
An operation that phases the eigenstates of a Pauli string.
cirq.PauliString, qubits: Optional[Sequence['cirq.Qid']] = None, *, exponent_neg: Union[int, float, sympy.Expr] = 1, exponent_pos: Union[int, float, sympy.Expr] = 0 ) -> None
This class takes
PauliString, which is a sequence of non-identity
Pauli operators, potentially with a \(\pm 1\) valued coefficient,
acting on qubits.
The -1 eigenstates of the Pauli string will have their amplitude multiplied by e^(i pi exponent_neg) while +1 eigenstates of the Pauli string will have their amplitude multiplied by e^(i pi exponent_pos).
The class also takes a list of qubits, which can be a superset of those
acted on by the provided
PauliString. Those extra qubits are assumed to be
acted upon via identity.
If coefficient is not 1 or -1 or the qubits of
can_merge_with( op: 'PauliStringPhasor' ) -> bool
Checks whether the underlying PauliStrings can be merged.
controlled_by( *control_qubits, control_values: Optional[Union[cv.AbstractControlValues, Sequence[Union[int, Collection[int]]]] ] = None ) -> 'cirq.Operation'
Returns a controlled version of this operation. If no control_qubits are specified, returns self.
||Qubits to control the operation by. Required.|
For which control qubit values to apply the
operation. A sequence of the same length as
equal_up_to_global_phase( other: 'PauliStringPhasor' ) -> bool
Checks equality of two PauliStringPhasors, up to global phase.
Maps the qubits inside the PauliStringPhasor.
||A map from the qubits in the phasor to new qubits.|
|A new PauliStringPhasor with remapped qubits.|
||If the map does not contain an entry for all the qubits in the phasor.|
merged_with( op: 'PauliStringPhasor' ) -> 'PauliStringPhasor'
Merges two PauliStringPhasors.
pass_operations_over( ops: Iterable[
cirq.Operation], after_to_before: bool = False ) -> 'PauliStringPhasor'
Determines how the Pauli phasor changes when conjugated by Cliffords.
The output and input pauli phasors are related by a circuit equivalence. In particular, this circuit:
will be equivalent to this circuit:
up to global phase (assuming
after_to_before is not set).
If ops together have matrix C, the Pauli string has matrix P, and the output Pauli string has matrix P', then P' == C^-1 P C up to global phase.
after_to_before inverts the relationship, so that the output
is the input and the input is the output. Equivalently, it inverts C.
||The operations to move over the string.|
||Determines whether the operations start after the pauli string, instead of before (and so are moving in the opposite direction).|
transform_qubits( qubit_map: Union[Dict['cirq.Qid', 'cirq.Qid'], Callable[['cirq.Qid'], 'cirq.Qid']] ) -> TSelf
Returns the same operation, but with different qubits.
||A function or a dict mapping each current qubit into a desired new qubit.|
|The receiving operation but with qubits transformed by the given function.|
||qubit_map was not a function or dict mapping qubits to qubits.|
validate_args( qubits: Sequence['cirq.Qid'] )
Raises an exception if the
qubits don't match this operation's qid
Call this method from a subclass's
||The new qids for the operation.|
||The operation had qids that don't match it's qid shape.|
with_classical_controls( *conditions ) -> 'cirq.Operation'
Returns a classically controlled version of this operation.
An operation that is classically controlled is executed iff all
conditions evaluate to True. Conditions can be either a measurement key
or a user-specified
cirq.Condition. A measurement key evaluates to
True iff any qubit in the corresponding measurement operation evaluated
to a non-zero value;
cirq.Condition supports more complex,
If no conditions are specified, returns self.
The classical control will remove any tags on the existing operation, since tags are fragile, and we always opt to get rid of the tags when the underlying operation is changed.
||A list of measurement keys, strings that can be parsed into measurement keys, or sympy expressions where the free symbols are measurement key strings.|
with_gate( new_gate: 'cirq.Gate' ) -> 'cirq.Operation'
with_probability( probability: 'cirq.TParamVal' ) -> 'cirq.Operation'
Creates a probabalistic channel with this operation.
||floating point value between 0 and 1, giving the probability this gate is applied.|
||if called on an operation that lacks a gate.|
with_qubits( *new_qubits ) -> TSelf
Returns the same operation, but applied to different qubits.
The new qubits to apply the operation to. The order must
exactly match the order of qubits returned from the operation's
with_tags( *new_tags ) -> 'cirq.Operation'
Creates a new TaggedOperation, with this op and the specified tags.
This method can be used to attach meta-data to specific operations without affecting their functionality. The intended usage is to attach classes intended for this purpose or strings to mark operations for specific usage that will be recognized by consumers. Specific examples include ignoring this operation in optimization passes, hardware-specific functionality, or circuit diagram customizability.
Tags can be a list of any type of object that is useful to identify this operation as long as the type is hashable. If you wish the resulting operation to be eventually serialized into JSON, you should also restrict the operation to be JSON serializable.
||The tags to wrap this operation in.|
without_classical_controls() -> 'cirq.Operation'
Removes all classical controls from the operation.
This function removes all classical controls gating the operation. It acts recursively, so that all classical control wrappers are always removed from the current operation.
If there are no classical controls on the operation, it will return
Since tags are fragile, this will also remove any tags from the operation,
when called on
TaggedOperation (unless there are no classical controls on it).
TaggedOperation is under all the classical control layers,
TaggedOperation will be returned from this function.
|The operation with all classical controls removed.|
__eq__( other: _SupportsValueEquality ) -> bool
__mul__( other: Any ) -> Any
__ne__( other: _SupportsValueEquality ) -> bool
__pow__( exponent: Any ) -> 'cirq.Operation'
Raise gate to a power, then reapply to the same qubits.
Only works if the gate implements cirq.ExtrapolatableEffect. For extrapolatable gate G this means the following two are equivalent:
(G ** 1.5)(qubit) or G(qubit) ** 1.5
||The amount to scale the gate's effect by.|
|A new operation on the same qubits with the scaled gate.|
__rmul__( other: Any ) -> Any