I am trying to find a proper way to write a code that will give me the resulting quantum state $i|10\rangle$ using qiskit in Python (using Jupiter notebook). I think I have figured out that the following works:
from qiskit import QuantumCircuit, execute, Aer
from math import pi
qc = QuantumCircuit(2,2)
qc.x(1)
qc.crz(3*pi,1,0)
which (if I choose to print the state vector) gives me this result:
job = execute(qc, Aer.get_backend(‘statevector_simulator’),optimization_level=0)
current_quantum_state = job.result().get_statevector(qc)
print(current_quantum_state)
—————————————————————————————————————————————————————————————————————————————————————
Statevector([0.00000000e+00+0.j, 0.00000000e+00+0.j, -2.22044605e-16+1.j,
0.00000000e+00-0.j],
dims=(2,2))
Using an X gate first and then a CRZ gate I get the result I want, but I was told that we can get this through just one line (therefore one gate?) and not the last two lines I provided. I looked everywhere through my notes and the Qiskit manual online, but I can’t seem to find something that works and I was wondering if someone could direct me to the faster approach to this.