Comments (5)
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
swap_circ = Circuit(3,1) # Create a Circuit with three qubits and one classical bit
swap_circ.H(0)
swap_circ.add_gate(OpType.CSWAP, [0,1,2]) # add controlled swap opeartion
swap_circ.H(0)
swap_circ.Measure(0,0) # Meaure the first qubit to the first classical register
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
from pytket-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.
from pytket-docs.
Yes, I am interested: Φ1=(|00> − i|11>), Φ2=(|01> −|11>) and calculate <Φ1|Φ2> and |Φ1>|Φ2>
Thanks.
from pytket-docs.
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.
from pytket-docs.
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
from pytket-docs.
Related Issues (20)
- [CI] New workflow for updating pre-commit hooks HOT 1
- pytket 1.1.0 depends on networkx~=2.4 HOT 1
- enable qsharp backend in comparing_simulators.py HOT 1
- remove `pre-commit == 3.0.0` from manual page HOT 1
- update to sphinx 6.2 HOT 5
- `optimisation_level=2` bug HOT 1
- `ImportError` with pytket>=1.20 and Python 3.11 HOT 2
- missing `ipykernel` requirement HOT 5
- Manual build failing HOT 2
- Re-enable warning-as-error for `sphinx-build` HOT 1
- BackendResult incorrect return types for strict type checking HOT 1
- Remove mention of retired IBM devices from user manual and examples HOT 2
- Fix manual and examples to be compatible with pytket-qiskit 0.49 HOT 1
- Latest pytket-qiskit incompatible with pytket-pyquil HOT 4
- Remove scipy version pin in manual build after next pytket release
- Use circuit renderer more in circuit construction manual
- TEST pytket-docs issue HOT 1
- Unify user manual and examples build
- Revise compilation section of the manual
- Revise Backends example notebooks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytket-docs.