ITensors.jl icon indicating copy to clipboard operation
ITensors.jl copied to clipboard

Add "RandomUnitary" gate

Open mtfishman opened this issue 4 years ago • 4 comments

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)).

mtfishman avatar Mar 18 '21 19:03 mtfishman

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

emstoudenmire avatar Mar 18 '21 19:03 emstoudenmire

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)

mtfishman avatar Mar 18 '21 19:03 mtfishman

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.

emstoudenmire avatar Mar 18 '21 19:03 emstoudenmire

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.

mtfishman avatar Mar 18 '21 20:03 mtfishman