Skip to content
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

Add "RandomUnitary" gate #594

Closed
mtfishman opened this issue Mar 18, 2021 · 4 comments
Closed

Add "RandomUnitary" gate #594

mtfishman opened this issue Mar 18, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@mtfishman
Copy link
Member

Add a "RandomUnitary" gate like in PastaQ: https://github.com/GTorlai/PastaQ.jl/blob/v0.0.6/src/circuits/gates.jl#L301-L313.

We would have to think about how it might work for QN ITensors (maybe the user could also specify the flux with a keyword argument, which would default to QN(0)).

@emstoudenmire
Copy link
Collaborator

Would be great to have. Would the flux not always be zero since it is a unitary?

@mtfishman
Copy link
Member Author

Probably it isn't common for gates, but what's wrong with having unitaries with nonzero flux?

julia> i = Index(QN(0) => 2)
(dim=2|id=88) <Out>
 1: QN(0) => 2

julia> j = Index(QN(1) => 2)
(dim=2|id=237) <Out>
 1: QN(1) => 2

julia> U = ITensor(qr(randn(2, 2)).Q * I, i, dag(j))
ITensor ord=2
(dim=2|id=88) <Out>
 1: QN(0) => 2
(dim=2|id=237) <In>
 1: QN(1) => 2
NDTensors.BlockSparse{Float64,Array{Float64,1},2}

julia> flux(U)
QN(-1)

@emstoudenmire
Copy link
Collaborator

Agreed it's technically possible. It's just that in every example I can think of which is tied to a specific problem or use-case I know about, a QN-conserving unitary has flux zero (isometric tensors of a canonical MPS, time-evolution operator, etc.). Also philosophically a unitary is a change of basis, and just viewing a tensor in a different basis shouldn't change its flux which is a scalar quantity.

But if we can think of a case where it's in some sense natural for the flux to be non-zero that could be interesting to know about.

Mostly I would just say if this is about making a random gate, then zero flux is probably what we want. Otherwise we'd have to get into a separate question of also choosing the flux randomly, and then what distribution should that be drawn from? Maybe there's an answer but I'm not sure.

@mtfishman
Copy link
Member Author

Sure, that's fair. Definitely not pushing the need for a nonzero flux unitary gate. The proposal was to use zero flux by default, and allow someone to specify a nonzero one if the need arises.

@kshyatt kshyatt added the enhancement New feature or request label Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants