The krotov.functionals.gate is supposed to find the unitary gate that maps input states onto "final" states:
|psi(t=T)> = U(t=T) |psi(0)> where the inputs of the function are typically N basis states (Hilbert space dimension = N) and then N final states.
The example code is here.. You can ignore everything but the last cell essentially.
The found gate using krotov.functionals.gate for a Schrödinger equation evolution is unitary (see last cell, first output), which should be case for a evolution that stems from a purely hermitian Hamiltonian. The function for kets in this case works.
If one does not use a Schrödinger equation evolution but employs a Liouvillian master equation without dissipation, the results are the same. This is proven by the trace distance (see output third to last cell) for every time step that is effectively zero. Intuitively the time evolution using both methods is equivalent as long as there is no dissipation. However, the resulting gate that is being calculated from the basis |00><00|,|01><01|,... is all of a sudden non-unitary (see last cell, third output). This does not make sense.
An even stronger example to show that something must be wrong is that taking the dyadic product of the initial and final kets from (1.) also results in a non-unitary gate (see last cell, second output).
Even if there is a bug in (2.), which is nearly impossible since the trace distance is zero, there is no way that in (3.) the same gate can become non-unitary by going into Liouville space. The check_unitary routine might be broken (it isnt) but even then you dont get the identity matrix, clearly showing non-unitary behavior.
Description
The krotov.functionals.gate is supposed to find the unitary gate that maps input states onto "final" states:
|psi(t=T)> = U(t=T) |psi(0)> where the inputs of the function are typically N basis states (Hilbert space dimension = N) and then N final states.
The example code is here.. You can ignore everything but the last cell essentially.
Even if there is a bug in (2.), which is nearly impossible since the trace distance is zero, there is no way that in (3.) the same gate can become non-unitary by going into Liouville space. The check_unitary routine might be broken (it isnt) but even then you dont get the identity matrix, clearly showing non-unitary behavior.