Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DensityMatrix snapshot extension #303

Closed
chriseclectic opened this issue Jul 29, 2019 · 0 comments · Fixed by #374
Closed

DensityMatrix snapshot extension #303

chriseclectic opened this issue Jul 29, 2019 · 0 comments · Fixed by #374
Labels
enhancement New feature or request
Milestone

Comments

@chriseclectic
Copy link
Member

chriseclectic commented Jul 29, 2019

What is the expected behavior?

This will be used by the density matrix method of the QasmSimulator.

class SnapshotDensityMatrix(Snapshot):
    __init__(self, label, num_qubits):
        super(label, "density_matrix", num_qubits, 0, None)
 

# Monkey patch function
def snapshot_density_matrix(self, label, qubits=None):
     # see base snapshot monkey patch for converting qubits to
     # be all qubits in circuit

circuit.snapshot_density_matrix = snapshot_density_matrix

The num_qubits parameter is actually ignored by Aer (it is always an all-qubit instruction), however it is used by Terra to make the snapshot act as a barrier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant