qojulia/QuantumOpticsBase.jl

copy(x::LazyTensor) fails

mabuni1998 opened this issue · 2 comments

When trying to copy a LazyTensor, if the indices are defined as a tuple, it fails. MWE:

ba = FockBasis(2)
a = destroy(ba)
b = destroy(ba)
ab = LazyTensor(ba⊗ba,(1,2),(a,b))
copy(ab)

Returning: ERROR: MethodError: no method matching copy(::Tuple{Int64, Int64})

If, instead, you define the LazyTensor with a vector for the indices, you don't get an error:

ab = LazyTensor(ba⊗ba,[1,2],(a,b))
copy(ab)

Version:
QuantumOptics v1.0.14
QuantumOpticsBase v0.4.18

Tuples do not have a copy method but they do have a deepcopy.

deepcopy should be a fair workaround for the moment, until we fix the copy method.