Skip to content

Commit 17d94cf

Browse files
smitsanghaviCirqBot
authored andcommitted
Add docstrings for additional methods in #2480 (#2489)
1 parent aade1f3 commit 17d94cf

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

cirq/sim/clifford/clifford_simulator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,14 @@ def to_numpy(self):
254254
return self.ch_form.to_state_vector()
255255

256256
def stabilizers(self) -> List[DensePauliString]:
257+
"""Returns the stabilizer generators of the state. These
258+
are n operators {S_1,S_2,...,S_n} such that S_i |psi> = |psi> """
257259
return self.tableau.stabilizers()
258260

259261
def destabilizers(self) -> List[DensePauliString]:
262+
"""Returns the destabilizer generators of the state. These
263+
are n operators {S_1,S_2,...,S_n} such that along with the stabilizer
264+
generators above generate the full Pauli group on n qubits."""
260265
return self.tableau.destabilizers()
261266

262267
def wave_function(self):

cirq/sim/clifford/clifford_tableau.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ def g(x1, z1, x2, z2):
169169
self.zs[q1, :] ^= self.zs[q2, :]
170170

171171
def _row_to_dense_pauli(self, i: int) -> DensePauliString:
172+
"""
173+
Args:
174+
i: index of the row in the tableau.
175+
Returns:
176+
A DensePauliString representing the row. The length of the string
177+
is equal to the total number of qubits and each character
178+
represents the effective single Pauli operator on that qubit. The
179+
overall phase is captured in the coefficient.
180+
"""
172181
coefficient = -1 if self.rs[i] else 1
173182
pauli_mask = ""
174183

0 commit comments

Comments
 (0)