Skip to content

Commit

Permalink
Skip pyQVM noise under the correct conditions (#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpharrigan authored and karalekas committed Feb 14, 2019
1 parent df9e97b commit 24b276e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyquil/reference_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ def reset(self) -> 'AbstractQuantumSimulator':

def do_post_gate_noise(self, noise_type: str, noise_prob: float, qubits: List[int]):
kraus_ops = KRAUS_OPS[noise_type](p=noise_prob)
if np.isclose(noise_prob, 1.0):
warnings.warn(f"Skipping {noise_type} post-gate noise because noise_prob is close to 1")
if np.isclose(noise_prob, 0.0):
warnings.warn(f"Skipping {noise_type} post-gate noise because noise_prob is close to 0")
return self

for q in qubits:
new_density = np.zeros_like(self.density)
Expand Down

0 comments on commit 24b276e

Please sign in to comment.