Hello everyone,
I am new both to Julia and ITensor, so apologies for the possible trivial question. I want to implement a TEBD algorithm on an MPS for a transmon (qutrit) system. The Hamiltonian is composed of two terms, drift and control, \mathcal{H}=\mathcal{H}_{\text{drift}}+\mathcal{H}_{\text{ctrl}}: for my particular case I need to rotate \mathcal{H} in the control-diagonal basis.
I figured that the best way to do it would be to define a custom operators as in this page via the matrix representation of the rotated operator O (\hat{\mathcal{R}}^\dagger O\hat{\mathcal{R}}, with \hat{\mathcal{R}} the rotating matrix whose columns are the eigenvectors of \mathcal{H}_{\text{ctrl}}) and then proceed as explained here.
The issue is that while the extension of the op
function for a SiteType
"S=1/2"
works as expected, if I try to change the class to "Qudit"
, ITensor doesn’t recognize the new operator and throws MethodError: no method matching _op(::OpName{:R}, ::SiteType{Qudit}; dim=(3,))
.
Below an example using Julia 1.7.3
and ITensors v0.3.18
.
ITensors.op(::OpName"R",::SiteType"Qudit") =
[1 0 0
0 1 0
0 0 1]
s = siteind("Qudit"; dim=3)
R = op("R",s)
@show R;
What am I missing here?
As a follow up question, is there a way to apply the same transformation (multiplication by a rotation matrix) to the state (MPS)?