# PySTE *vs.* [QuTiP](https://qutip.org) To benchmark against [QuTiP](https://qutip.org) we plot the runtime against infidelity for evolving a state vector for $T=10$ units of time under the Hamiltonian $$ H_1(t)=H_0+H_c\cos(2\pi t), $$ where $H_0$ and $H_c$ are randomly generated using ```python import numpy as np H = np.random.rand(DIM, DIM)+1j*np.random.rand(DIM, DIM) H = H + H.T.conj() ``` To estimate the infidelity we evolve the system for these 10 seconds and then evolve the system under the Hamiltonian: $$ H_2(t)=-H_0-H_c\cos(2\pi [T-t]), $$ This will leave the unitary describing the full evolution as the identity. We then calculate the infidelity of the final state $\left|\psi_f\right\rangle$ to the initial state $\left|\psi_i\right\rangle$ $$ \mathcal I=1-\left|\left\langle\psi_f\middle|\psi_i\right\rangle\right|^2 $$ We plot the runtime for the evolution of $H_1(t)$ against the infidelity $\mathcal I$ for each trial. For our initial state we use a state randomly generated by ```python import numpy as np state = np.random.rand(DIM).astype(np.complex128) state /= np.linalg.norm(state) ``` The [QuTiP](https://qutip.org) optimisers we compare to are: - [adams](https://qutip.readthedocs.io/en/stable/apidoc/solver.html#qutip.solver.integrator.scipy_integrator.IntegratorScipyAdams) - [bdf](https://qutip.readthedocs.io/en/stable/apidoc/solver.html#qutip.solver.integrator.scipy_integrator.IntegratorScipyBDF) - [dop853](https://qutip.readthedocs.io/en/stable/apidoc/solver.html#qutip.solver.integrator.scipy_integrator.IntegratorScipyDop853) - [lsoda](https://qutip.readthedocs.io/en/stable/apidoc/solver.html#qutip.solver.integrator.scipy_integrator.IntegratorScipylsoda) - [vern7](https://qutip.readthedocs.io/en/stable/apidoc/solver.html#qutip.solver.integrator.qutip_integrator.IntegratorVern7) - [vern9](https://qutip.readthedocs.io/en/stable/apidoc/solver.html#qutip.solver.integrator.qutip_integrator.IntegratorVern9) To obtain the best performance from [QuTiP](https://qutip.org) we use their String ([Cython](https://cython.org/)) coefficients (see [QuTiP documentation](https://qutip.readthedocs.io/en/stable/guide/dynamics/dynamics-time.html#coefficients)). Below we present the data for vector space dimensions 2, 4, 8, 16, and 32. We find that PySTE has a a worse asymptotic scaling with both infidelity and dimension that [QuTiP](https://qutip.org)'s integrators. However, PySTE appears to have a smaller perfector allowing for runtime accelerations by up to a factor of 100 for small systems. As much of current day quantum research focuses on gaining intuition for small systems we believe this non-asymptotic speed-up is useful and can accelerate research. If you are simulating larger systems then [QuTiP](https://qutip.org) likely suits your use case better. ## 2-dimensional ![results/plots/benchmark_against_qutip.png](results/plots/benchmark_against_qutip.png) ## 4-dimensional ![results/plots/benchmark_against_qutip_dim_4.png](results/plots/benchmark_against_qutip_dim_4.png) ## 8-dimensional ![results/plots/benchmark_against_qutip_dim_8.png](results/plots/benchmark_against_qutip_dim_8.png) ## 16-dimensional ![results/plots/benchmark_against_qutip_dim_16.png](results/plots/benchmark_against_qutip_dim_16.png) ## 32-dimensional ![results/plots/benchmark_against_qutip_dim_32.png](results/plots/benchmark_against_qutip_dim_32.png)