2
$\begingroup$

Some parts of my quantum circuit uses initialize to prepare specific amplitudes to the qubits. However, the Qiskit Runtime outputs error:

"Unable to retrieve job result. HighLevelSynthesis was unable to synthesize Instruction(name='reset', num_qubits=1, num_clbits=0, params=[]). -- Verify the input circuits and the traspilation options. -- https://ibm.biz/error_codes#1516"

Could it be because initialize function contains reset which is not unitary. If so, how can one initialize specific complex amplitudes to the qubits in Qiskit runtime?

$\endgroup$

1 Answer 1

4
$\begingroup$

Indeed, the problem is that initialize introduces a reset (see docs).

from qiskit import QuantumCircuit
circuit = QuantumCircuit(2)
circuit.initialize('11', [0, 1], normalize=False)
circuit.decompose().draw()
          ┌─────────────────────────┐
q_0: ─|0>─┤0                        ├
          │  State Preparation(1,1) │
q_1: ─|0>─┤1                        ├
          └─────────────────────────┘
       ^
here is the reset

You have two options.

Option 1: Remove the resets in the front:

from qiskit.transpiler.passes import RemoveResetInZeroState
circuit = RemoveResetInZeroState()(circuit.decompose())
circuit.draw()
     ┌─────────────────────────┐
q_0: ┤0                        ├
     │  State Preparation(1,1) │
q_1: ┤1                        ├
     └─────────────────────────┘

Option 2: Use StatePreparation directly instead of initialize:

from qiskit import QuantumCircuit
from qiskit.circuit.library import StatePreparation

circuit = QuantumCircuit(2)
circuit.append(StatePreparation('11'), [0, 1])
circuit.draw()
     ┌─────────────────────────┐
q_0: ┤0                        ├
     │  State Preparation(1,1) │
q_1: ┤1                        ├
     └─────────────────────────┘
$\endgroup$
3
  • $\begingroup$ Thanks a lot for your reply! By the way, I tried your Option 1 in the IBM system and it says "The instruction initialize on qubits is not supported by the target system. Circuits that do not match the target hardware definition are no longer supported after March 4, 2024." Guess there is only option 2, then? Is StatePreparation really just initialize without the reset in front? $\endgroup$
    – Deren Liu
    Mar 12 at 7:42
  • $\begingroup$ Also, if I run "backend.supported_instructions", it has "reset" in the list. Why is this? $\endgroup$
    – Deren Liu
    Mar 12 at 7:51
  • $\begingroup$ 'The instruction state_preparation on qubits (0, 1, 2, 3, 4) is not supported by the target system. Circuits that do not match the target hardware definition are no longer supported after March 4, 2024'. It seems both initialize and StatePreparation do not work? $\endgroup$
    – Deren Liu
    Mar 13 at 15:14

Your Answer

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

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