Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndentityOp seems to be destroying some basis information #80

Closed
Krastanov opened this issue Aug 13, 2024 · 1 comment · Fixed by #81
Closed

IndentityOp seems to be destroying some basis information #80

Krastanov opened this issue Aug 13, 2024 · 1 comment · Fixed by #81
Labels
bug Something isn't working

Comments

@Krastanov
Copy link
Member

julia> express(IdentityOp(X1))
Operator(dim=3x3)
  basis: Fock(cutoff=2)
Eye(3)

julia> express(X1)
Ket(dim=2)
  basis: Spin(1/2)
 0.7071067811865475 + 0.0im
 0.7071067811865475 + 0.0im

I would have expected the basis to be the same in both cases, but it seems IndentityOp is losing some information and defaulting to a Fock basis even when it should not be a Fock basis.

@apkille , any idea what introduced this? It was detected by the QuantumSavory tests, which regrettably we did not run because we were having a breaking release

@apkille
Copy link
Member

apkille commented Aug 14, 2024

@Krastanov the problem was that the express_nolookup(x::IdentityOp, r::QuantumOpticsRepr) automatically converted an IdentityOp to an identity operator in the Fock basis in QO.jl (I admit that's my bad). Perhaps a quicker workaround would be defining

express_nolookup(x::IdentityOp, r::QuantumOpticsRepr) = isa(x.basis, FockBasis) ? identityoperator(FockBasis(r.cutoff)) : identityoperator(x.basis)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants