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

dagger fails when data is a LinearAlgebra.adjoint #64

Open
Krastanov opened this issue Oct 14, 2022 · 0 comments
Open

dagger fails when data is a LinearAlgebra.adjoint #64

Krastanov opened this issue Oct 14, 2022 · 0 comments

Comments

@Krastanov
Copy link
Collaborator

julia> op = Operator(GenericBasis(1),GenericBasis(2),[1,1]')
Operator(dim=1x2)
  basis left:  Basis(dim=1)
  basis right: Basis(dim=2)
[1 1]

julia> op'
ERROR: DimensionMismatch: Tried to assign data of size (2,) to bases of length 2 and 1!

This error happens because Julia does not guarantee that size(a')==reverse(size(a)). In particular:

julia> size([1,1])
(2,)

julia> size([1,1]')
(1, 2)

julia> size([1,1]'') # Quantum optics currently expects the answer to be (2,1)
(2,)

julia> size([1;;1])
(1, 2)

julia> size([1;;1]')
(2, 1)

Related to solutions provided in qojulia/QuantumOptics.jl#322

@Krastanov Krastanov changed the title dagger failes when data is a LinearAlgebra.adjoint dagger fails when data is a LinearAlgebra.adjoint Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant