Plot 'input' and 'output' states in quantum circuit

149 views
Skip to first unread message

Morten Kjaergaard

unread,
Apr 3, 2017, 12:33:04 PM4/3/17
to QuTiP: Quantum Toolbox in Python
Hi all,

I'm enjoying using QuTiP, in particular for testing out my understanding of small quantum circuits and algorithms.

However, I was wondering if it's possible to add a feature (or maybe it's already possible and I can't figure out how?), where it is possible to show which state is being input into the QuantumCircuit? E.g
|\uparrow> ------- [ H ] ------ |+>
where, right now, I can only show:
------- [ H ] ------
I'm of course not asking for qutip to calculate what the circuit does, but just to let the user add a latex-symbol (e.g. $|\uparrow\rangle$) by hand at the input/output ends of each of the qubits in the circuit.

I know it's straightforward to do in the LaTeX qcircuit package, that I think is running in the background of QuTiP, so maybe it's not a big issue.

Thanks again for the tremendously nice and useful package,
-m

Shahnawaz Ahmed

unread,
Apr 4, 2017, 6:48:24 AM4/4/17
to QuTiP: Quantum Toolbox in Python
Hi Morten,

Thank you for reaching out. I understand what you are suggesting and it is a very good idea to have something to show the state input and outputs.

I was wondering if it's possible to add a feature (or maybe it's already possible and I can't figure out how?)

I believe QuTiP does not have this right now as the QubitCircuit class right now only contains the following and the latex visualisation follows from this.

 - N: number of qubits, reverse_states, gates, U_list: Unitaries

I know it's straightforward to do in the LaTeX qcircuit package, that I think is running in the background of QuTiP, so maybe it's not a big issue.
 
It is possible and needs a change in the QubitCircuit class to have two new varibles input_states, output_states - and have the corresponding qcircuit circuit drawn. We may need to discuss what is the default option to be used for the output state.

I have done this as a hack in a module I was working on by making the input states as new gates. I am opening a new issue to discuss and implement this on Github. Feel free to add in your comments and suggestions there.

Shahnawaz Ahmed

unread,
Apr 4, 2017, 7:06:49 AM4/4/17
to QuTiP: Quantum Toolbox in Python
The Github issue where this can be further discussed and developed : https://github.com/qutip/qutip/issues/678

Shahnawaz Ahmed

unread,
Apr 4, 2017, 1:52:15 PM4/4/17
to QuTiP: Quantum Toolbox in Python
Hi,

I have finished implementing input states for a quantum circuit. You can have a look at this pull request - https://github.com/qutip/qutip/pull/679. A new function `add_state` can be used to add input or output states to a circuit. Currently, only input states will be displayed.

Once, this is reviewed and added to QuTiP, you can use it to add input states and add visualisations. If you need the patch to do this before qutip is updated, do let me know. I can help you set it up. :-) Thanks for raising the issue.

Morten Kjaergaard

unread,
Apr 4, 2017, 2:54:02 PM4/4/17
to QuTiP: Quantum Toolbox in Python
Hi Shahnawaz!

Thanks a lot for your very first answer (and resolution!). This is tremendously useful. I will defer more comments and questions to the github to keep this coherent :-)

Again, thanks a lot for your swift answer,

Best,
-morten
Reply all
Reply to author
Forward
0 new messages