0
$\begingroup$

I have a quantum circuit of 16 qubits, and I am running Amplitude Estimation on that, my final qubit to measure is 15th, so I do this

problem = EstimationProblem(
state_preparation = qcirc,
objective_qubits = [15],
)

and for Amplitude estimation:

# construct amplitude estimation
ae = IterativeAmplitudeEstimation(
epsilon_target=epsilon,
alpha=alpha,
sampler=Sampler(run_options={"shots": 100})
)

where the values of epsilon and alpha are 0.01 and 0.05

The finally when I run it:

result = ae.estimate(problem)

It is giving me the following error:

CircuitError: 'The amount of clbit arguments 0 does not match the instruction expectation (16).'

My qcirc has 16 qubits and 16 classical registers, I started by qcirc as

qcirc = QuantumCircuit(16,16)

What might be the reason for this error?

$\endgroup$

1 Answer 1

0
$\begingroup$

It's difficult to tell without the code you used to define qcirc, but... Did you add measurements to your circuit? If you haven't, you can try running qcirc.measure_all() before defining your EstimationProblem.

$\endgroup$
4
  • $\begingroup$ Measuring the entire circuit kind of defeats the purpose, since I only want to measure one specific qubit . qcirc is simply a 16 qubit circuit with some adders and rotation on some qubits. $\endgroup$ May 25 at 12:07
  • $\begingroup$ Yes, that is true, you would only need to measure specific qubits (my bad), and the AE class adds registers to perform measurements for you (see line 198 and 199 here). Thus, I think that the problem was not lack of classical bits, but excess of them. Can you try to remove the classical bits from your circuit? i.e, do qcirc = QuantumCircuit(16) instead of qcirc = QuantumCircuit(16,16). $\endgroup$
    – ElenaPT
    May 25 at 15:57
  • $\begingroup$ Let me know if this fixes it. If this is the case, there should be a more meaningful error message in the class. $\endgroup$
    – ElenaPT
    May 25 at 15:58
  • $\begingroup$ No, it did not fixed the error, but i now know why the error is there, so basically the EstimationProblem and the AE asks for grover operator, even tho i have specified the grover operator to be none, it's running the error from there. $\endgroup$ May 26 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.