Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cirq-core/cirq/circuits/moment.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,18 @@ def transform_qubits(
return self.__class__(op.transform_qubits(qubit_map) for op in self.operations)

def expand_to(self, qubits: Iterable['cirq.Qid']) -> 'cirq.Moment':
"""Returns self expanded to given superset of qubits by making identities explicit."""
"""Returns self expanded to given superset of qubits by making identities explicit.

Args:
qubits: Iterable of `cirq.Qid`s to expand this moment to.

Returns:
A new `cirq.Moment` with identity operations on the new qubits
not currently found in the moment.

Raises:
ValueError: if this moments' qubits are not a subset of `qubits`.
"""
if not self.qubits.issubset(qubits):
raise ValueError(f'{qubits} is not a superset of {self.qubits}')

Expand Down