Hello,
I am having a similar issue, so I thought I would just add to this thread! I have tried to use the complex!() function when I define my complex op:
ITensors.op(::OpName"YRot", ::SiteType"S=1/2", s::Index) = complex!((sqrt(2))*(op("Sy", s) + op("Sz", s)))
But I also get an InExactError thrown when I try and define and MPO with the op:
YRotMPO = MPO(sites, "YRot")
InexactError: Float64(0.0 - 0.7071067811865475im)
I have also tried defining a function, following the example above:
function ITensors.op(Op::ITensor, ::OpName"YRotfunc", ::SiteType"S=1/2", s::Index)
Op = ITensor(ComplexF64,s',dag(s))
Op[s'=>1,s=>1] = 1/sqrt(2)
Op[s'=>2,s=>1] = -im/sqrt(2)
Op[s'=>1,s=>2] = im/sqrt(2)
Op[s'=>2,s=>2] = 1/sqrt(2)
return Op
end
But this also throws the same error when I try and construct an MPO from it:
YRotMPOfunc = MPO(sites, "YRotfunc")
InexactError: Float64(0.0 - 0.7071067811865475im)
Any advice would be much appreciated! I am running v0.1 of ITensor -- I have been using Julia Pro, which for some reason only installs the v0.1 version by default.