QuantumBFS / Yao.jl

Extensible, Efficient Quantum Algorithm Design for Humans.
https://yaoquantum.org
Other
918 stars 119 forks source link

Adding qudit gates #412

Closed orodrigoaraizabravo closed 2 years ago

orodrigoaraizabravo commented 2 years ago

I am working on general VQE problems with qudits. I have code that produces the Pauli operators sigmax(s), etc for spin s particles. I'd like to implement rotations Rotation(sigmax(s), theta) on the qudits, but the function Rotation in Yao relies on the Pauli operator being reflexive which is only true for spin-1/2. What's the best way to implement more general rotations? Also, in the future I'd like to implement gates of the type exp(-imthetaP_iP_j) where P_i, P_j are Pauli operators for spin-s particles. Can we also get support for that?

GiggleLiu commented 2 years ago

relies on the Pauli operator being reflexive which is only true for spin-1/2

Rotation gate requires your generator to be reflexive, otherwise the result might be incorrect. For 3-level systems, you can still defined a reflexive gate. But here maybe you want to create a rotation gate for subspace, then use time evolution instead would be a solution. They are only different by a factor of 2.

julia> mat(time_evolve(X, 0.5)) ≈ mat(rot(X, 1.0))
true
GiggleLiu commented 2 years ago

I would suppose the above comment resolves the issue?