![]() |
Abstract base class for generic types.
cirq.ops.MutablePauliString(
coefficient: Union[int, float, complex] = 1,
*contents,
pauli_int_dict: Optional[Dict[TKey, int]] = None
)
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
frozen() -> "cirq.PauliString"
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
get(
key: cirq.ops.pauli_string.TKey
,
default=None
)
inplace_after
inplace_after(
ops: "cirq.OP_TREE"
) -> "cirq.MutablePauliString"
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
inplace_before(
ops: "cirq.OP_TREE"
) -> "cirq.MutablePauliString"
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
inplace_left_multiply_by(
other: "cirq.PAULI_STRING_LIKE"
) -> "cirq.MutablePauliString"
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
inplace_right_multiply_by(
other: "cirq.PAULI_STRING_LIKE"
) -> "cirq.MutablePauliString"
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
items() -> Iterator[Tuple[TKey, Union['cirq.Pauli', 'cirq.IdentityGate']]]
keys
keys() -> AbstractSet[cirq.ops.pauli_string.TKey
]
mutable_copy
mutable_copy() -> "cirq.MutablePauliString"
Returns a new cirq.MutablePauliString with the same contents.
values
values() -> Iterator[Union['cirq.Pauli', 'cirq.IdentityGate']]
__bool__
__bool__() -> bool
__contains__
__contains__(
item: Any
) -> bool
__eq__
__eq__(
other: _SupportsValueEquality
) -> bool
__getitem__
__getitem__(
item: Any
) -> Union['cirq.Pauli', 'cirq.IdentityGate']
__iter__
__iter__() -> Iterator[cirq.ops.pauli_string.TKey
]
__len__
__len__() -> int
__mul__
__mul__(
other: "cirq.PAULI_STRING_LIKE"
) -> "cirq.PauliString"
Multiplies two pauli-string-likes together.
The result is not mutable.
__ne__
__ne__(
other: _SupportsValueEquality
) -> bool
__rmul__
__rmul__(
other: "cirq.PAULI_STRING_LIKE"
) -> "cirq.PauliString"
Multiplies two pauli-string-likes together.
The result is not mutable.