Comments (4)
Thanks for the interest. I actually don't use raw matrix multiplication for the bulk of the backend calculations. That's because most linalg libraries don't know how to exploit the tensor product structure of quantum circuits. By knowing how the matrices are constructed, as a tensor product of smaller matrices, we never need to construct the full matrix and can skip entries we know will be 0. This is faster even than sparse representations.
I should set up some benchmarks to explicitly compare this though.
from rustqip.
Yeah, I have not checked the codebase in super detail. Just tossing around this idea in case some of the ops can be formulated in a way that is relevant to faer rs
from rustqip.
Added some benchmarks across a few backends.
Here I'm just testing a single 2x2 matrix applied to qubit 0 and identity applied elsewhere -- most benchmarks are on 12 qubits, the "large" ones are on 15 qubits.
I test 4 backends: qip
(this library), ndarray
, sprs
(sparse matrices), and faer
.
test tests::bench_ones_faer_reuse_arena ... bench: 6,446,267 ns/iter (+/- 47,841)
test tests::bench_ones_ndarray_build_each ... bench: 142,738,247 ns/iter (+/- 980,752)
test tests::bench_ones_ndarray_reuse ... bench: 4,600,275 ns/iter (+/- 404,325)
test tests::bench_ones_ndarray_reuse_arena ... bench: 4,604,027 ns/iter (+/- 562,828)
test tests::bench_ones_qip ... bench: 58,430 ns/iter (+/- 1,756)
test tests::bench_ones_qip_large ... bench: 1,289,297 ns/iter (+/- 23,239)
test tests::bench_ones_sprs_build_each ... bench: 103,473 ns/iter (+/- 637)
test tests::bench_ones_sprs_build_each_large ... bench: 38,890,543 ns/iter (+/- 616,850)
test tests::bench_ones_sprs_reuse ... bench: 17,702 ns/iter (+/- 205)
test tests::bench_ones_sprs_reuse_large ... bench: 5,318,135 ns/iter (+/- 47,856)
It looks like faer isn't performing very well compared to the others so I'm worried I didn't write the benchmark properly, if you're familiar with the library I'm open to changes.
from rustqip.
Followup: After talking with the faer devs on their discord it seems it isn't really the best choice for backend. Their matrix on vector support is not prioritized and performs no better than using blas with 1 thread. I'll close this for now but keep the bench around.
from rustqip.
Related Issues (20)
- Improve documentation and add more inline doc examples.
- Find minimum version numbers for dependencies.
- Add support for statistical mixtures of quantum states.
- Add circuit serialization.
- Add a wiki with resources for learning quantum computing
- Add more benchmarks HOT 5
- Make op which reads from a mutable variable for tuning circuits. HOT 1
- Add Feynman path integral backend HOT 2
- Fix the endianess problem
- Clippy lints HOT 3
- Allow the `program!` macro to pass arguments to the gates. HOT 2
- GPU Backend support
- Document grovers algorithm example HOT 3
- Add circuit compilation + optimization HOT 1
- Rewrite for 1.0 HOT 4
- Can this library/crate implement an MBQC? HOT 1
- Add QASM output HOT 2
- Linear type and quantum logic HOT 1
- Debug QFFT HOT 1
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 rustqip.