cirq.ops.MutablePauliString

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::

class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: ... # Etc.

This class can then be used as follows::

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

Methods

frozen

View source

Returns a cirq.PauliString with the same contents.

For example, this is useful because cirq.PauliString is an operation whereas cirq.MutablePauliString is not.

get

View source

inplace_after

View source

Propagates the pauli string from before to after a Clifford effect.

If the old value of the MutablePauliString is $P$ and the Clifford operation is $C$, then the new value of the MutablePauliString is $C P C^\dagger$.

Args
ops A stabilizer operation or nested collection of stabilizer operations.

Returns
The mutable pauli string that was mutated.

inplace_before

View source

Propagates the pauli string from after to before a Clifford effect.

If the old value of the MutablePauliString is $P$ and the Clifford operation is $C$, then the new value of the MutablePauliString is $C^\dagger P C$.

Args
ops A stabilizer operation or nested collection of stabilizer operations.

Returns
The mutable pauli string that was mutated.

inplace_left_multiply_by

View source

Left-multiplies a pauli string into this pauli string.

Args
other A pauli string or cirq.PAULI_STRING_LIKE to left-multiply into self.

Returns
The self mutable pauli string that was mutated.

Raises
TypeError other was not a cirq.PAULI_STRING_LIKE. self was not mutated.

inplace_right_multiply_by

View source

Right-multiplies a pauli string into this pauli string.

Args
other A pauli string or cirq.PAULI_STRING_LIKE to right-multiply into self.

Returns
The self mutable pauli string that was mutated.

Raises
TypeError other was not a cirq.PAULI_STRING_LIKE. self was not mutated.

items

View source

keys

View source

mutable_copy

View source

Returns a new cirq.MutablePauliString with the same contents.

transform_qubits

View source

Returns a mutable pauli string with transformed qubits.

Args
func The qubit transformation to apply.
inplace If false (the default), creates a new mutable pauli string to store the result. If true, overwrites this mutable pauli string's contents. Defaults to false for consistency with cirq.PauliString.transform_qubits in situations where the pauli string being used may or may not be mutable.

Returns
A transformed MutablePauliString. If inplace=True, returns self. If inplace=False, returns a new instance.

values

View source

__bool__

View source

__contains__

View source

__eq__

View source

__getitem__

View source

__iter__

View source

__len__

View source

__mul__

View source

Multiplies two pauli-string-likes together.

The result is not mutable.

__ne__

View source

__neg__

View source

__pos__

View source

__rmul__

View source

Multiplies two pauli-string-likes together.

The result is not mutable.