Comments (16)
Fortunately, our simplifier just works for the follow composite blocks (multi-qubits blocks contains single qubits Paulis)
julia> using YaoBlocks
julia> g = chain(2, kron(X, chain(X, Y)), control(2, 1=>X))
nqubits: 2, datatype: Complex{Float64}
chain
├─ kron
│ ├─ 1=>X gate
│ └─ 2=>chain
│ ├─ X gate
│ └─ Y gate
└─ control(2)
└─ (1,)X gate
julia> simplify(g)
nqubits: 2, datatype: Complex{Float64}
prod
├─ control(2)
│ └─ (1,)X gate
└─ kron
├─ 1=>X gate
└─ 2=>[-im] Z gate
I think next step is to define simplification rules for Cliffords, which will work for multi-qubits circuit in general. Probably this part should be moved to another package in the future, but whoever interested in this feature could start trying YaoBlocks with it now.
from yaoblocks.jl.
Merging pauli gates might be a useful feature.
But please don't use prod
in unitary evolutions, this example just shows how terrible it is.
from yaoblocks.jl.
This is useful and this is not related to this issue, see #9. The point to use prod here is just because it's easy to implement. I think eventually these things should be move to a single package for symbolic computing and circuit optimization. But we can use it for now.
from yaoblocks.jl.
it's easy to implement
Not implementing it would be better. For preventing potential errors.
from yaoblocks.jl.
I don't see any potential errors, you can't construct/desctruct a Prod without operators.
from yaoblocks.jl.
The point of #9 is when someone really hit something, it's never too late to make things work. We can't make everything work with one go.
from yaoblocks.jl.
when someone really hit something.
I think we both agreed that our development should be demand-driven.
Then, we should remove the Prod
, keep the issue and wait for the feature requests. Prod
is a replaceable structure, it is almost parallel to chain in functionality.
from yaoblocks.jl.
It's something required for simplify for now, if this is removed, it won't work at all. I don't think remove functionality is a good idea. The point is we could remove Prod after implementation a pass for chain.
It's not something breaking the API, since Prod is just a temporary representation of * and Prod. And not something preventing things not to work.
from yaoblocks.jl.
There should not be too much overlap between Prod
and ChainBlock
, make it possible or remove Prod
.
remove Prod after implementation a pass for chain
Don't get this point.
from yaoblocks.jl.
I can just remove Chain's pass so simplify only works for Prod. And add it back when we have time to implement one for Chain.
from yaoblocks.jl.
ok, then please also polish the printing
instead of
prod
|- X gate
|- Y gate
print X*Y
.
from yaoblocks.jl.
This printing should be a bug. I'll have a look when I'm back.
Ok now */prod strictly corresponding to Prod, nothing else will create a Prod node implicitly. (It's just one line anyway)
from yaoblocks.jl.
@GiggleLiu The printing is correct:
julia> X * Y
nqubits: 1, datatype: Complex{Float64}
prod
├─ X gate
└─ Y gate
I don't get
prod
|- X gate
|- Y gate
from yaoblocks.jl.
I mean, X*Y
would be better.
from yaoblocks.jl.
But this will mess up the following
control(2, 1, 2=>X) * kron(X, Y)
which make sense for simplification and basis, etc. (they are Cliffords) and I don't think it's trivial to workaround that. I'd like to keep what it is now, at least it is readable (it won't be readable at all for composite block in a single line).
X * Y
only works for primitive blocks, since you don't need multiple lines.
from yaoblocks.jl.
you are right.
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.