Skip to content

Commit

Permalink
[BugFix] circuit.sample fix (#303)
Browse files Browse the repository at this point in the history
circuit.sample was incorrect as there were two instructions for
obtaining probabilities. We only need one instructions depending on
whether we have a dendity matrix or a state vector.
chMoussa authored Dec 30, 2024
1 parent ef035ec commit b9ca3a6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pyqtorch/circuit.py
Original file line number Diff line number Diff line change
@@ -100,9 +100,8 @@ def sample(
start_dim=0,
end_dim=-2,
).t()
probs = torch.abs(torch.pow(state, 2))
probs = torch.pow(torch.abs(state), 2)

probs = torch.pow(torch.abs(state), 2)
if self.readout_noise is not None:
probs = self.readout_noise.apply(probs, n_shots)
counters = list(

0 comments on commit b9ca3a6

Please sign in to comment.