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

Cubic spline extrapolation of the Hamiltonian by QuTip #153

Open
Louis-PaulHenry opened this issue May 12, 2021 · 2 comments
Open

Cubic spline extrapolation of the Hamiltonian by QuTip #153

Louis-PaulHenry opened this issue May 12, 2021 · 2 comments
Assignees
Labels
archive Smthg to keep in mind, but not worth implementing now

Comments

@Louis-PaulHenry
Copy link
Collaborator

Louis-PaulHenry commented May 12, 2021

When building the Hamiltonian QobjEvo, the entire list of samples of a Sequence is given to QuTip.
QuTip will then extrapolate (with Cubic spline) the values of the coefficients in between. This leads to artifacts when defining a piecewise constant pulse, at the transitions between plateaus.
One way to correct that would be to split the Sequence into constant and time-dependant parts and tell QuTip about it.
From QuTip documentation :

The times of the tlist do not need to be equidistant, but must be sorted. By default, a cubic spline interpolation will be used for the coefficient at time t. If the coefficients are to be treated as step functions, use the arguments args = {"_step_func_coeff": True}.

One way to edit build_coeffs_ops would be to split qobj_listinto the list of objects to be extrapolated (say qobj_list_spline) and the list to be kept piecewise constant (say qobj_list_pwcst) and replace

ham = qutip.QobjEvo(qobj_list, tlist=self._times)

by

ham_spline = qutip.QobjEvo(qobj_list_spline, tlist=self._times)
ham_pwcst = qutip.QobjEvo(qobj_list_pwcst, tlist=self._times, args = {"_step_func_coeff": True})
ham = ham_spline + ham_pwcst

@sebgrijalva sebgrijalva added the enhancement New feature or request label Aug 10, 2021
@Louis-PaulHenry
Copy link
Collaborator Author

Now that I'm thinking about it. Another way to solve this issue would be to discard the sampling times altogether and to build the Hamiltonian QobjEvo by giving the functional dependence of the coefficients. This way Qutip doesn't do any interpolating

@Louis-PaulHenry Louis-PaulHenry added archive Smthg to keep in mind, but not worth implementing now and removed enhancement New feature or request labels Sep 8, 2021
@Louis-PaulHenry
Copy link
Collaborator Author

Louis-PaulHenry commented Sep 8, 2021

Using the _step_func_coeff argument in sesolve only gives a ~20% speedup when the Pulse is completely piecewise constant. Otherwise, it only gives a small increase in accuracy, at the expanse of a large slowing down of the computation.

Here is a short notebook illustrating the effect :
pwc.ipynb.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archive Smthg to keep in mind, but not worth implementing now
Projects
None yet
Development

No branches or pull requests

2 participants