qojulia / QuantumOpticsBase.jl

Base functionality library for QuantumOptics.jl
Other
64 stars 34 forks source link

copy(x::LazyTensor) fails #149

Open mabuni1998 opened 11 months ago

mabuni1998 commented 11 months ago

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)
mabuni1998 commented 11 months ago

Version: QuantumOptics v1.0.14 QuantumOpticsBase v0.4.18

Krastanov commented 11 months ago

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.