Unable to take tensor product of outer products
Closed this issue · 1 comments
apkille commented
julia> @ket k; @bra b;
julia> (k*b) ⊗ (k*b)
ERROR: MethodError: *(::SKet, ::SKet) is ambiguous.
Candidates:
*(x::SymbolicUtils.Symbolic{T}, c) where T<:Union{QuantumInterface.AbstractBra, QuantumInterface.AbstractKet, QuantumInterface.AbstractOperator, QuantumInterface.AbstractSuperOperator}
@ QuantumSymbolics ~/Documents/Julia Packages/QuantumJulia/QuantumSymbolics.jl/src/QSymbolicsBase/basic_ops_homogeneous.jl:34
*(c, x::SymbolicUtils.Symbolic{T}) where T<:Union{QuantumInterface.AbstractBra, QuantumInterface.AbstractKet, QuantumInterface.AbstractOperator, QuantumInterface.AbstractSuperOperator}
@ QuantumSymbolics ~/Documents/Julia Packages/QuantumJulia/QuantumSymbolics.jl/src/QSymbolicsBase/basic_ops_homogeneous.jl:33
Possible fix, define
*(::SymbolicUtils.Symbolic{T}, ::SymbolicUtils.Symbolic{T}) where {T<:Union{…}, T<:Union{…}}
Stacktrace:
[1] prefactorscalings(xs::Vector{SOuterKetBra}; scalar::Bool)
@ QuantumSymbolics ~/Documents/Julia Packages/QuantumJulia/QuantumSymbolics.jl/src/QSymbolicsBase/rules.jl:26
[2] prefactorscalings
@ ~/Documents/Julia Packages/QuantumJulia/QuantumSymbolics.jl/src/QSymbolicsBase/rules.jl:19 [inlined]
[3] STensorOperator(terms::Vector{SOuterKetBra})
@ QuantumSymbolics ~/Documents/Julia Packages/QuantumJulia/QuantumSymbolics.jl/src/QSymbolicsBase/basic_ops_homogeneous.jl:158
[4] tensor(::SOuterKetBra, ::SOuterKetBra)
@ QuantumSymbolics ~/Documents/Julia Packages/QuantumJulia/QuantumSymbolics.jl/src/QSymbolicsBase/basic_ops_homogeneous.jl:170
[5] top-level scope
@ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.
apkille commented
It seems that prefactorscalings
attempts to factor out the objects in the outer products. Will address this issue in upcoming PR.