Comments (2)
It will be more obvious when you pack a few instruct
together, e.g using chained put blocks.
using StaticArrays, BenchmarkTools
U = @SMatrix rand(ComplexF64, 2, 2)
st = rand(ComplexF64, 1<<20)
julia> @benchmark foreach(k->instruct2!($st, $U, 2), 1:100)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 180.581 ms (0.00% GC)
median time: 186.595 ms (0.00% GC)
mean time: 186.496 ms (0.00% GC)
maximum time: 193.396 ms (0.00% GC)
--------------
samples: 27
evals/sample: 1
julia> @benchmark foreach(k->instruct2!($st, $(Matrix(U)), 2), 1:100)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 169.435 ms (0.00% GC)
median time: 187.297 ms (0.00% GC)
mean time: 188.134 ms (0.00% GC)
maximum time: 208.341 ms (0.00% GC)
--------------
samples: 27
evals/sample: 1
from yaoblocks.jl.
But SMatrix
should be faster
julia> @benchmark foreach(k->instruct3!($st, $U, 2), 1:100)
BenchmarkTools.Trial:
memory estimate: 80 bytes
allocs estimate: 1
--------------
minimum time: 10.900 ns (0.00% GC)
median time: 13.812 ns (0.00% GC)
mean time: 24.196 ns (38.99% GC)
maximum time: 50.778 μs (99.92% GC)
--------------
samples: 10000
evals/sample: 998
julia> @benchmark foreach(k->instruct3!($st, $(Matrix(U)), 2), 1:100)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 63.906 ns (0.00% GC)
median time: 67.717 ns (0.00% GC)
mean time: 71.838 ns (0.00% GC)
maximum time: 212.529 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 976
from yaoblocks.jl.
Related Issues (20)
- incorrect error msg HOT 1
- Make measurement result change inplace HOT 1
- rm mathgate etc.
- convert Rx(0) to floating point HOT 1
- StaticArrays warning
- move faithful gradient & extend sampling interface for expect
- register HOT 23
- add docs to constant gates
- optimize `repeat(n, H)` by Wlash-Hadamard transform
- doc improvement of expect' HOT 2
- The different behaviors between `expect` and `expect'` when inputting a pair of register and circuit
- return the expectation and its gridient in the same function exp' HOT 1
- TagBot trigger issue HOT 11
- `mat_back!` for custom blocks HOT 1
- What does `adjcunmat` do? HOT 6
- integration with IBMQClient
- define my custom gate but cannot use mat function HOT 6
- how can I implement two blocks sharing same parameters? HOT 6
- Zygote patch not working when involving non-unitary blocks HOT 1
- Zygote: transposing a block yields DimensionMismatch (or missing adjoint) HOT 7
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 yaoblocks.jl.