(sent from a reader to @mercedesGS )
This is regarding QISKIT code sample 3-3: Phase Kickback. According to the book, value of register 2 shall be 1 not 0.
However, if you run QISKIT 3-3 sample code, you can see that it’s 0.
## Example 3-3: Phase Kickback
# Set up the program
reg1 = QuantumRegister(2, name = 'reg1')
reg2 = QuantumRegister(1, name = 'reg2')
qc = QuantumCircuit(reg1, reg2)
qc.h(reg1) # put it into reg1 superposition of 0 and 1
qc.cu1(math.pi/4, reg1[0], reg2)
qc.cu1(math.pi/2, reg1[1], reg2)
backend = BasicAer.get_backend('statevector_simulator')
job = execute(qc, backend)
result = job.result()
outputstate = result.get_statevector(qc, decimals=3)
print(outputstate)
qc.draw()
(sent from a reader to @mercedesGS ) This is regarding QISKIT code sample 3-3: Phase Kickback. According to the book, value of register 2 shall be 1 not 0.
However, if you run QISKIT 3-3 sample code, you can see that it’s 0.
How can I change it to 1 from 0 for register 2?