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

Cyclic dependence of gate M and MeasurementResult #1433

Closed
BrunoLiegiBastonLiegi opened this issue Aug 31, 2024 · 1 comment · Fixed by #1465
Closed

Cyclic dependence of gate M and MeasurementResult #1433

BrunoLiegiBastonLiegi opened this issue Aug 31, 2024 · 1 comment · Fixed by #1465
Assignees

Comments

@BrunoLiegiBastonLiegi
Copy link
Contributor

Currently the gate M and the MeasurementResult object cyclically depend on each other:

self.result = MeasurementResult(self)

self.measurement_gate = gate

I would argue that this is not really necessary and introduces unneeded complications. The MeasurementResult, indeed, appears to be using the .measurement_gate just to retrieve the qubits (.measurement_gate.target_qubits). For this reason, I would propose to remove this dependence and, for instance, build a MeasurementResult object just starting from the measured qubit indices, rather than the whole measurement gate (as discussed in #1431 already).

@alecandido
Copy link
Member

build a MeasurementResult object just starting from the measured qubit indices, rather than the whole measurement gate

In principle, you could even avoid storing indices in there, since they are already in the gate (it would be redundant information).
For methods that require that (which actually only require the number of measured qubits) you could even get it as an argument, or, even better, infer from the shots shape (since they are the results for a single gate, and the number of qubits to which the gate is applied should match one of the dimensions of the shots shape).

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

Successfully merging a pull request may close this issue.

2 participants