Quantum Computing Asked by Leeseok Kim on September 10, 2020
Suppose we start from 2 wires (q0 and q1) and through some quantum gates, suppose we measure q1 wire only.
As we measure the q1 wire, the state vector of this quantum state would be determined immediately. How can I print out this state vector?
In addition, I would like to print out the state vector of q0 wire only. Does anyone know how to do this task via qiskit or cirq or pyquil? (Any other package language is also fine!)
This task can be done using Microsoft Q#
If you have two qubits which after quantum operations are in the state $|psirangle$.
If you wish to find the state of the qubit q0
before/without measurement. You can use
Q#
's DumpRegister
function which will print to the console the state of your qubits.
The output would look something like this
# wave function for qubits with ids (least to most significant): 0
∣0❭: 1.000000 + 0.000000 i == ******************** [ 1.000000 ] --- [ 0.00000 rad ]
∣1❭: 0.000000 + 0.000000 i == [ 0.000000 ]
If you choose to Measure the qubit q0
then its state collapses to the result of your measuremententer preformatted text here
.
Answered by vasjain on September 10, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP