-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a simple example for inner/outer product of single qubit states? #169
Comments
Hi, thank you for your question. I currently don't think we have a documented example on calculating inner and outer products specifically. This would be a good thing for us to add. A simple method to calculate the inner product between two states I have included a screenshot of the circuit below You can implement this test circuit using the following pytket code
If then append this swap_circ onto the circuit where you prepare your states then you can calculate the inner product bases on the measurement results. If any of this is unclear I'm happy to add more detail. I can also prepare a small example for the docs |
Are there particular examples on the outer product that you would find helpful? It would be good to know more detail about what you are looking for. |
Yes, I am interested: Φ1=(|00> − i|11>), Φ2=(|01> −|11>) and calculate <Φ1|Φ2> and |Φ1>|Φ2> Thanks. |
Okay the inner product you mentioned can be worked out by hand to be equal to 1*i. This value will change if you normalise the states. If you want to calculate inner products using circuits then the SWAP test I mentioned generalises for states with more qubits... You just add some extra CSWAP gates between the two registers. In this case the registers q[1] and q[2] will correspond to multi-qubit states. the |phi1;> |phi2;> term you mentioned is a tensor product. There is some explanation of tensor products here https://www.quantiki.org/wiki/tensor-product. The outer product of two statevectors is usually written |phi_1><phi_2| and the answer corresponds to a matrix rather than a scalar or a vector. I've included a screenshot of the outer product of your two states below. I hope this helps - let me know if there is more I can help with. |
I will close this issue for now - if you have further questions feel free to get in touch again. You can also ask questions on our public slack channel -> https://tketusers.slack.com/join/shared_invite/zt-18qmsamj9-UqQFVdkRzxnXCcKtcarLRA#/shared-invite/email |
No description provided.
The text was updated successfully, but these errors were encountered: