Open flowerthrower opened 7 months ago
If you know that diff
is not hermitian, you should be able to set diff._isherm = False
so the isherm is defined at compilation.
The reason of the if else
is for users experience. Traces of dm are expected to be real.
Thank you Eric, I guess it does not hurt to set diff._isherm = False
for my problem (even if in some cases it might be Hermitian). Another workaround is to directly call diff.data.trace()
.
The issue raised the question, if it would be more sensible to put the if else
clause into the datalayer implementation of tr
(and e.g. dag
).
The following code:
will trigger
TracerBoolConversionError
due to the if/else clause inqutip.core.qobj.tr()
(same goes forqutip.core.qobj.dag()
). Seequtip.core.qobj
:I understand that the subtraction operation
diff = evo.final_state - qt.destroy(2, dtype="jax")
might result in a non-Hermitian operator, so the value is not defined before runtime -> raising the error. However, to me it seems that the if-else clause is not strictly necessary (I guess the reason for it, is performance of thetr()
anddag()
method). Is there a way to prevent this within the jax-package or does that require changes inqutip.core.qobj
?