1
$\begingroup$

I used the following code. Can anyone say what that error is about?

from qiskit.aqua.circuits.gates import mct
q = QuantumRegister(32)
c = ClassicalRegister(11)
qc = QuantumCircuit(q,c)
ite = 5 #number of iteration

#initialization
qc.h(q[0:11])
qc.x(q[22])
qc.h(q[22])
qc.barrier()

for i in range(ite):
#oracle part
    ccheck(0,1,11)
    ccheck(0,2,12)
    ccheck(0,3,13)
    ccheck(0,4,14)
    ccheck(0,5,15)
    ccheck(0,6,16)
    ccheck(0,7,17)
    ccheck(0,8,18)
    ccheck(0,9,19)
    ccheck(0,10,20)
    qc.mct([q[11],q[12],q[13], q[14],q[15],q[16], q[17],q[18],q[19], q[20]], q[29] , [q[21], q[22], q[23], q[24], q[25], q[26], q[27], q[28]], mode='basic') 
    iccheck(0,10,20)
    iccheck(0,9,19)
    iccheck(0,8,18)
    iccheck(0,7,17)
    iccheck(0,6,16)
    iccheck(0,5,15)
    iccheck(0,4,14)
    iccheck(0,3,13)
    iccheck(0,2,12)
    iccheck(0,1,11)
    qc.barrier()
#diffusion part
    qc.h(q[0:11])
    qc.barrier()
    qc.x(q[0:11])
    qc.barrier()
    qc.h(q[10])
    qc.mct([q[0],q[1],q[2], q[3],q[4],q[5], q[6],q[7],q[8], q[9]], q[10] , [q[21], q[22], q[23], q[24], q[25], q[26], q[27], q[28]], mode='basic')
    qc.h(q[10])
    qc.barrier()
    qc.x(q[0:11])
    qc.barrier()
    qc.h(q[0:11])
    qc.barrier()

qc.measure(q[0:11], c[0:11])

backend = Aer.get_backend('qasm_simulator')
job = execute(qc, backend, shots=10000)
result = job.result()
count =result.get_counts()
print(count)
qc.draw(output='mpl')

```
$\endgroup$
9
  • 1
    $\begingroup$ Not sure if you need to run this on Aer or not, but I tested running it on the ibmq_qasm_simulator and it did not throw an error immediately like it does when running on Aer's qasm_simulator. It has not finished running yet, but looks like it is dodging that error $\endgroup$ Oct 11, 2019 at 14:54
  • 1
    $\begingroup$ Job finished running and I received a result, so I believe it should work on ibmq_qasm_simulator $\endgroup$ Oct 11, 2019 at 15:26
  • $\begingroup$ @MatthewStypulkoski can u please post the modified code here in the comments. It will useful. $\endgroup$ Oct 11, 2019 at 16:36
  • 1
    $\begingroup$ Yes, that error is related to the shots being 10000. The max amount of shots allowed is 8192 I believe. $\endgroup$ Oct 11, 2019 at 17:21
  • 1
    $\begingroup$ Yes, thats right.Thanks.Its gonna take an hour or so to execute and run. $\endgroup$ Oct 11, 2019 at 17:30

0

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.

Browse other questions tagged or ask your own question.