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

LRE error with qiskit circuit #2584

Closed
purva-thakre opened this issue Nov 26, 2024 · 2 comments · Fixed by #2599
Closed

LRE error with qiskit circuit #2584

purva-thakre opened this issue Nov 26, 2024 · 2 comments · Fixed by #2599
Assignees
Labels
bug Something isn't working lre Layerwise Richardson Extrapolation
Milestone

Comments

@purva-thakre
Copy link
Collaborator

purva-thakre commented Nov 26, 2024

When attempting to get the sample matrrix of a qiskit circuit, the process fails with AttributeError: 'QuantumCircuit' object has no attribute 'are_all_measurements_terminal'. This error should not be raised as the circuit of interest does not contain any measurements.

The error points to the following line where the scale factor vectors are generated and used by the sample matrix function:

scale_factor_vectors = get_scale_factor_vectors(
input_circuit, degree, fold_multiplier, num_chunks
)

The function to generate the scale factor vectors relies on

Code

ghz_circuit = generate_ghz_circuit(4, "qiskit")
circuit = ghz_circuit.compose(ghz_circuit.inverse())
print(circuit)

     ┌───┐                              ┌───┐
q_0: ┤ H ├──■────────────────────────■──┤ H ├
     └───┘┌─┴─┐                    ┌─┴─┐└───┘
q_1: ─────┤ X ├──■──────────────■──┤ X ├─────
          └───┘┌─┴─┐          ┌─┴─┐└───┘     
q_2: ──────────┤ X ├──■────■──┤ X ├──────────
               └───┘┌─┴─┐┌─┴─┐└───┘          
q_3: ───────────────┤ X ├┤ X ├───────────────
                    └───┘└───┘               


sample_matrix(circuit, 2, 2)
@purva-thakre purva-thakre added bug Something isn't working lre Layerwise Richardson Extrapolation labels Nov 26, 2024
@purva-thakre
Copy link
Collaborator Author

purva-thakre commented Nov 26, 2024

Compatibility of LRE with non-Cirq frontends was ensured in #2547. To resolve this issue, we should add the corresponding unit tests in mitiq/lre/tests/test_multivariate_richardson.py which were skipped in the linked PR.

This is definitely related to #2542 (comment)

@purva-thakre purva-thakre self-assigned this Nov 26, 2024
@natestemen
Copy link
Member

This is definitely related to #2542 (comment)

Ahhh 🙈 sorry! Since I worked on this previously, would it be easiest if I take it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lre Layerwise Richardson Extrapolation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants