SoftwareQuTech / SimulaQron

Quantum Network Simulator for Application Programming
Other
112 stars 53 forks source link

[Question] How to see the probability distribution of a qubit? #208

Closed invalidexplorer closed 4 years ago

invalidexplorer commented 5 years ago

Hi everyone! I am trying to make a U3 gate and to test it, I need to see the probability distribution, how can I do that in simulaqron? Also is there a better way to test the gates?

AckslD commented 5 years ago

Hi @invalidexplorer!

You cannot directly get the probability distribution rather than effectively doing tomography. You might wonder why this is the case. The reason for this is that your application communicates with the backend simulation through the CQC interface. The CQC interface is intended to also be used in a quantum network with real hardware. In a real network you cannot access the probability distribution and this is therefore not supported in CQC. I have recently been thinking whether it could be useful to support a "debug"-connection to the backend in parallel to the CQC interface for such things.

invalidexplorer commented 5 years ago

Hi @invalidexplorer!

You cannot directly get the probability distribution rather than effectively doing tomography. You might wonder why this is the case. The reason for this is that your application communicates with the backend simulation through the CQC interface. The CQC interface is intended to also be used in a quantum network with real hardware. In a real network you cannot access the probability distribution and this is therefore not supported in CQC. I have recently been thinking whether it could be useful to support a "debug"-connection to the backend in parallel to the CQC interface for such things.

Hi @AckslD , I feel its a great Idea to add a parallel debug connection as running the program again and again for multiple measurements can be time consuming. Also is there any inbuit function for multiple measurements to get an approximate state of the qubit?

AckslD commented 5 years ago

@invalidexplorer

I added an issue for implementing a debug connection, see https://github.com/SoftwareQuTech/SimulaQron/issues/209. However, unless someone else takes charge on this it might take quite a while, especially since I'm currently away on an internship.

Regarding multiple measurements to approximate a state, there is a simple tomography function in the CQC python library for single qubit states, see https://github.com/SoftwareQuTech/CQC-Python/blob/dc8c4b3db5d3739f7203c546c1775b5a252b9f56/cqc/pythonLib.py#L1329

invalidexplorer commented 5 years ago

@invalidexplorer

I added an issue for implementing a debug connection, see #209. However, unless someone else takes charge on this it might take quite a while, especially since I'm currently away on an internship.

Regarding multiple measurements to approximate a state, there is a simple tomography function in the CQC python library for single qubit states, see https://github.com/SoftwareQuTech/CQC-Python/blob/dc8c4b3db5d3739f7203c546c1775b5a252b9f56/cqc/pythonLib.py#L1329

@AckslD , is there anyway I can perform this operation on multiple qubits? e.g to check the states on multiple entangled qubits? since measurement of qubits isnt a mutually exclusive event

AckslD commented 5 years ago

@invalidexplorer Multi-qubit state-tomography is currently not implemented but you could implement it yourself. To do multi-qubit Pauli measurements you can use the functions in https://github.com/SoftwareQuTech/CQC-Python/blob/master/cqc/pythonLib_protocols/measurements.py