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

Yield from mesolve/sesolve #93

Open
goerz opened this issue Jun 8, 2021 · 2 comments
Open

Yield from mesolve/sesolve #93

goerz opened this issue Jun 8, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@goerz
Copy link
Member

goerz commented Jun 8, 2021

(just a note to myself for an idea that I might want to explore at some point)

In the absence of a Cython implementation of the Chebychev or Newton propagatos, tapping into qutip.mesolve would still be great for having a propagator with sufficient performance to run an optimization beyond toy models. The problem is that mesolve propagates over the entire time grid, and has no way to propagate a single time step in an efficient way. Instead of a major refactoring of the mesolve code into something that would be useful for krotov, it might be very straightforward to copy the qutip.mesolve and qutip.sesolve modules and to plug in yield statements where QuTiP stores the propagated states into the result objects.

@goerz
Copy link
Member Author

goerz commented Jun 11, 2021

There is one complication beyond just iterating over the states: I have to be able to modify the controls in every time step.

I'm not sure if mesolve internally keeps a simple reference to H which would allow me to change H in-place. If yes, and if mesolve were to yield the propagated states, then the following snippet should do the job:

for (i, state) in enumerate(
    mesolve([H0, [H1, ctrl_array]], state0, list)
):
    # assuming `state` is at tlist[i]
    new_val = calculate_control_value_for_next_step(state)
    ctrl_array[i] = new_val
    ctrl_array[i+1] = new_val  # ignoring IndexError

It's sufficient to assume that the time-dependency ctrl_array is a numpy array.

@goerz
Copy link
Member Author

goerz commented May 26, 2024

This is probably superseded by #119, but we'll see if that pans out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant