Skip to content

Commit

Permalink
Add docstrings for additional methods in #2480 (#2489)
Browse files Browse the repository at this point in the history
  • Loading branch information
smitsanghavi authored and CirqBot committed Nov 7, 2019
1 parent aade1f3 commit 17d94cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cirq/sim/clifford/clifford_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,14 @@ def to_numpy(self):
return self.ch_form.to_state_vector()

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

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

def wave_function(self):
Expand Down
9 changes: 9 additions & 0 deletions cirq/sim/clifford/clifford_tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ def g(x1, z1, x2, z2):
self.zs[q1, :] ^= self.zs[q2, :]

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

Expand Down

0 comments on commit 17d94cf

Please sign in to comment.