-
Notifications
You must be signed in to change notification settings - Fork 4
Description
currently, because of all the routines we are interested in are unitaries, we treat the input state as the same as the output state which is true for quantum circuits. However, recently we find these routines are also useful for simulating hamiltonians in ODE solvers when the parameters are local/individual which as a result the output state will not be the same as the input state since it will be the intermediate difference in the ODE solver.
This is already hard to change on YaoArrayRegister side, so let's change the convention of broutine! etc. here to assume the input and output can be different (while in most cases they are the same).
e.g as a result operations like swap rows of a vector will be
tmp = input[I]
output[I] = input[J]
output[J] = tmpwhich handles the case input === output but also handles the case input !== output, and it is preferred to have a factor option in our broutine! which make it more similar to a standard matrix multiplication but in the subspace and will help to avoid an extra broadcast! when multiplying the factors of a hamiltonian