You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the bug report. Yes, it should be possible to left and right multiply any Qobj with a 1x1 Qobj, so that's a bug.
Regarding returning a C number, it has been discussed in #28. There is no question that psi.dag() * psi is a C number, but in my opinion it should be a C number represented as 1x1 Qobj, not a Python complex. The reason is that arithmetics with Qobj should form an algebra. It can be important that if x and y is a Qobj then we should always have that x_y is a Qobj as well, so that one always can do for example z=x_y and then z.dims or call some Qobj method on z. If z is not a Qobj this breaks. This is my opinion on this matter, but not everyone agreed. See #28.
As I see bra-ket products, e.g.
result in 1x1 Qobjects, not numbers.
(I know why, as it is compatible with matrix multiplication of
1xn times nx1
.)However, it behaves differently
For example, for
works fine, but
throws an exception.
On paper, once we get a c-number, we shouldn't care if about its order in the multiplication.
Are there any reasons not to automatically convert 1x1 Qobj into a (complex) number?
The text was updated successfully, but these errors were encountered: