1
$\begingroup$

I am trying to add the measurement of Alice and bob's circuit to the singlet circuit. Actually, I am trying to build the e91 protocol. But it is giving me an error like this.

circuits = []

for i in range(numberOfSinglets):
    circuitName = str(i) + ':A' + str(aliceMeasurementChoices[i]) + '_B' + str(bobMeasurementChoices)

    alice_circuit = aliceMeasurements[aliceMeasurementChoices[i]-1]
    bob_circuit = bobMeasurements[bobMeasurementChoices[i]-1]

    QuantumCircuit.append(circuitName, singlet & alice_circuit & bob_circuit)

    # add the created circuit to the circuits list
    circuits.append(circuitName)

AttributeError Traceback (most recent call last) Cell In[96], line 9 6 alice_circuit = aliceMeasurements[aliceMeasurementChoices[i]-1] 7 bob_circuit = bobMeasurements[bobMeasurementChoices[i]-1] ----> 9 QuantumCircuit.append(circuitName, singlet & alice_circuit & bob_circuit) 11 # add the created circuit to the circuits list 12 circuits.append(circuitName)

File ~/anaconda3/envs/QC/lib/python3.11/site-packages/qiskit/circuit/quantumcircuit.py:1276, in QuantumCircuit.append(self, instruction, qargs, cargs) 1273 expanded_qargs = [self.qbit_argument_conversion(qarg) for qarg in qargs or []] 1274 expanded_cargs = [self.cbit_argument_conversion(carg) for carg in cargs or []] -> 1276 if self._control_flow_scopes: 1277 appender = self._control_flow_scopes[-1].append 1278 requester = self._control_flow_scopes[-1].request_classical_resource

AttributeError: 'str' object has no attribute '_control_flow_scopes'

$\endgroup$
1
  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Commented Nov 21, 2023 at 9:09

0

Your Answer

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