Open knodelgino opened 3 years ago
@GroenteLepel
Thank you very much for this contribution. I must admit: it has been a while since I have taken a look at this code. I do remember however Qiskitβs reversed order of qubits and having to fiddle around with that.
I appreciate your thoughts on this, and I would suggest you create a merge request of your solution so that I can merge it!
awesome, I will look into it.
@GroenteLepel created a PR here: https://github.com/GroenteLepel/qiskit-quantum-knn/pull/12
When computing fidelities/contrasts, there is a step where we map the states of the computational basis (e.g. '10010101') back to integers using
However, I read in the documentation of Qiskit that the ordering they use for tensor product states is the opposite of most physics textbooks:
I think this means we might have to change the code to
I played around with this a little bit in a juptyer notebook, where I tried to explicitly compute the fidelities of some sample states, and found that without this change, a lot of them get swapped around. Reversing the order as above seems to fix the issue.
If what I'm saying is correct, we'd have to make 2 changes:
https://github.com/GroenteLepel/qiskit-quantum-knn/blob/2b382089f8ffdd0301dca09fb5807efdddc19fa0/qiskit_quantum_knn/qknn/qkneighborsclassifier.py#L366
https://github.com/GroenteLepel/qiskit-quantum-knn/blob/2b382089f8ffdd0301dca09fb5807efdddc19fa0/qiskit_quantum_knn/qknn/qkneighborsclassifier.py#L441