-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
MWE:
using MPSKitModels
S_exchange(Float64)Output:
ERROR: InexactError: Float64(0.0 - 0.5im)
Stacktrace:
[1] Real
@ ./complex.jl:44 [inlined]
[2] convert
@ ./number.jl:7 [inlined]
[3] setindex!(::Matrix{Float64}, ::ComplexF64, ::Int64, ::Int64)
@ Base ./array.jl:983
[4] spinmatrices(s::Rational{Int64}, elt::Type)
@ MPSKitModels ~/.julia/packages/MPSKitModels/RcUP6/src/operators/spinoperators.jl:31
[5] #S_x#42
@ ~/.julia/packages/MPSKitModels/RcUP6/src/operators/spinoperators.jl:61 [inlined]
[6] S_x
@ ~/.julia/packages/MPSKitModels/RcUP6/src/operators/spinoperators.jl:60 [inlined]
[7] S_xx(elt::Type{Float64}, ::Type{TensorKit.Trivial}; spin::Rational{Int64})
@ MPSKitModels ~/.julia/packages/MPSKitModels/RcUP6/src/operators/spinoperators.jl:382
[8] S_xx
@ ~/.julia/packages/MPSKitModels/RcUP6/src/operators/spinoperators.jl:381 [inlined]
[9] S_exchange(elt::Type{Float64}, ::Type{TensorKit.Trivial}; spin::Rational{Int64})
@ MPSKitModels ~/.julia/packages/MPSKitModels/RcUP6/src/operators/spinoperators.jl:422
[10] S_exchange(elt::Type{Float64}, ::Type{TensorKit.Trivial})
@ MPSKitModels ~/.julia/packages/MPSKitModels/RcUP6/src/operators/spinoperators.jl:421
[11] S_exchange(elt::Type{Float64}; kwargs::@Kwargs{})
@ MPSKitModels ~/.julia/packages/MPSKitModels/RcUP6/src/operators/spinoperators.jl:416
[12] top-level scope
@ REPL[3]:1
It appears that the construction uses eltype as a real type. Although I can circumvent the issue by real(S_exchange()), it may still be better to be able to directly create it as a real operator. A possible solution (at least for spin-1/2) is to use
Metadata
Metadata
Assignees
Labels
No labels