qutip/qutip: QuTiP 5.0.0
- Robert Johansson
- Paul Nation1
- Eric Giguère2
- Simon Cross3
- Jake Lishman4
- Anubhav Vardhan5
- Alexander Pitchford6
- Cassandra Granade7
- Asier Galicia
- Boxi Li8
- Yuji TAMAKOSHI9
- Paul
- Emi
- christian512
- Nathan Shammah10
- Arne Løhre Grimsmo
- Markus Baden
- Piotr Migdał11
- Shahnawaz Ahmed12
- Kevin Fischer13
- Denis Vasilyev14
- Purva Thakre15
- Neill Lambert
- sbisw002
- Mahdi Aslani16
- trentfridey17
- Mark Johnson
- Pieter Eendebak
- Daniel Weiss
- 1. IBM
- 2. Calcul Québec, Université de Sherbrooke
- 3. RIKEN
- 4. @IBM
- 5. IIT Kanpur / RIKEN
- 6. Aberystwyth University
- 7. Dual Space Solutions, LLC
- 8. Forschungszentrum Jülich
- 9. University of Tokyo
- 10. Unitary Fund
- 11. ex: Quantum Flytrap CTO & cofounder
- 12. @embedl Chalmers, Riken @qutip @pyquantum @qgrad
- 13. @opensouls
- 14. IQOQI
- 15. Southern Illinois University
- 16. University of Isfahan
- 17. Integrated DNA Technologies
Description
QuTiP 5.0.0
QuTiP 5 is a redesign of many of the core components of QuTiP (Qobj,
QobjEvo, solvers) to make them more consistent and more flexible.
Qobj may now be stored in either sparse or dense representations,
and the two may be mixed sensibly as needed. QobjEvo is now used
consistently throughout QuTiP, and the implementation has been
substantially cleaned up. A new Coefficient class is used to
represent the time-dependent factors inside QobjEvo.
The solvers have been rewritten to work well with the new data layer
and the concept of Integrators which solve ODEs has been introduced.
In future, new data layers may provide their own Integrators
specialized to their representation of the underlying data.
Much of the user-facing API of QuTiP remains familiar, but there have had to be many small breaking changes. If we can make changes to easy migrating code from QuTiP 4 to QuTiP 5, please let us know. A notebook to help with migration is available on colab.
An extensive list of changes follows.
Contributors
QuTiP 5 has been a large effort by many people over the last three years.
In particular:
- Jake Lishman led the implementation of the new data layer and coefficients.
- Eric Giguère led the implementation of the new QobjEvo interface and solvers.
- Boxi Li led the updating of QuTiP's QIP support and the creation of
qutip_qip.
Other members of the QuTiP Admin team have been heavily involved in reviewing, testing and designing QuTiP 5:
- Alexander Pitchford
- Asier Galicia
- Nathan Shammah
- Shahnawaz Ahmed
- Neill Lambert
- Simon Cross
- Paul Menczel
Two Google Summer of Code contributors updated the tutorials and benchmarks to QuTiP 5:
- Christian Staufenbiel updated many of the tutorials.
- Xavier Sproken update the benchmarks.
During an internship at RIKEN, Patrick Hopf created a new quantum control method and improved the existing methods interface:
- Patrick Hopf created new quantum control package.
Four experimental data layers backends were written either as part of Google Summer of Code or as separate projects. While these are still alpha quality, they helped significantly to test the data layer API:
qutip-tensorflow: a TensorFlow backend by Asier Galicia (https://github.com/qutip/qutip-tensorflow)qutip-cupy: a CuPy GPU backend by Felipe Bivort Haiek (https://github.com/qutip/qutip-cupy/)qutip-tensornetwork: a TensorNetwork backend by Asier Galicia (https://github.com/qutip/qutip-tensornetwork)qutip-jax: a JAX backend by Eric Giguère (https://github.com/qutip/qutip-jax/)
Finally, Yuji Tamakoshi updated the visualization function and added animation functions as part of Google Summer of Code project.
We have also had many other contributors, whose specific contributions are detailed below:
- Pieter Eendebak (updated the required SciPy to 1.5+, #1982)
- Pieter Eendebak (reduced import times by setting logger names, #1981)
- Pieter Eendebak (Allow scipy 1.12 to be used with qutip, #2354)
- Xavier Sproken (included C header files in the source distribution, #1971)
- Christian Staufenbiel (added support for multiple collapse operators to the Floquet solver, #1962)
- Christian Staufenbiel (fixed the basis used in the Floquet Master Equation solver, #1952)
- Christian Staufenbiel (allowed the
bloch_redfield_tensorfunction to accept strings and callables fora_ops, #1951) - Christian Staufenbiel (Add a guide on Superoperators, Pauli Basis and Channel Contraction, #1984)
- Henrique Silvéro (allowed
qutip_qipto be imported asqutip.qip, #1920) - Florian Hopfmueller (added a vastly improved implementations of
process_fidelityandaverage_gate_fidelity, #1712, #1748 , #1788) - Felipe Bivort Haiek (fixed inaccuracy in docstring of the dense implementation of negation, #1608)
- Rajath Shetty (added support for specifying colors for individual points, vectors and states display by
qutip.Bloch, #1335) - Rochisha Agarwal (Add dtype to printed ouput of qobj, #2352)
- Kosuke Mizuno (Add arguments of plot_wigner() and plot_wigner_fock_distribution() to specify parameters for wigner(), #2057)
- Matt Ord (Only pre-compute density matrices if keep_runs_results is False, #2303)
- Daniel Moreno Galán (Add the possibility to customize point colors as in V4 and fix point plot behavior for 'l' style, #2303)
- Sola85 (Fixed simdiag not returning orthonormal eigenvectors, #2269)
- Edward Thomas (Fix LaTeX display of Qobj state in Jupyter cell outputs, #2272)
- Bogdan Reznychenko (Rework
kraus_to_choimaking it faster, #2284) - gabbence95 (Fix typos in
expectdocumentation, #2331) - lklivingstone (Added repr to QobjEvo, #2111)
- Yuji Tamakoshi (Improve print(qutip.settings) by make it shorter, #2113)
- khnikhil (Added fermionic annihilation and creation operators, #2166)
- Daniel Weiss (Improved sampling algorithm for mcsolve, #2218)
- SJUW (Increase missing colorbar padding for matrix_histogram_complex() from 0 to 0.05, #2181)
- Valan Baptist Mathuranayagam (Changed qutip-notebooks to qutip-tutorials and fixed the typo in the link redirecting to the changelog section in the PR template, #2107)
- Gerardo Jose Suarez (Added information on sec_cutoff to the documentation, #2136)
- Cristian Emiliano Godinez Ramirez (Added inherited members to API doc of MESolver, SMESolver, SSESolver, NonMarkovianMCSolver, #2167)
- Andrey Rakhubovsky (Corrected grammar in Bloch-Redfield master equation documentation, #2174)
- Rushiraj Gadhvi (qutip.ipynbtools.version_table() can now be called without Cython installed, #2110)
- Harsh Khilawala (Moved HTMLProgressBar from qutip/ipynbtools.py to qutip/ui/progressbar.py, #2112)
- Avatar Srinidhi P V (Added new argument bc_type to take boundary conditions when creating QobjEvo, #2114)
- Andrey Rakhubovsky (Fix types in docstring of projection(), #2363)
Qobj changes
Previously Qobj data was stored in a SciPy-like sparse matrix. Now the
representation is flexible. Implementations for dense and sparse formats are
included in QuTiP and custom implementations are possible. QuTiP's performance
on dense states and operators is significantly improved as a result.
Some highlights:
- The data is still acessible via the
.dataattribute, but is now an instance of the underlying data type instead of a SciPy-like sparse matrix. The operations available inqutip.core.datamay be used on.data, regardless of the data type. Qobjwith different data types may be mixed in arithmetic and other operations. A sensible output type will be automatically determined.- The new
.to(...)method may be used to convert aQobjfrom one data type to another. E.g..to("dense")will convert to the dense representation and.to("csr")will convert to the sparse type. - Many
Qobjmethods and methods that createQobjnow accepted adtypeparameter that allows the data type of the returnedQobjto specified. - The new
&operator may be used to obtain the tensor product. - The new
@operator may be used to obtain the matrix / operator product.bar @ ketreturns a scalar. - The new
.contract()method will collapse 1D subspaces of the dimensions of theQobj. - The new
.logm()method returns the matrix logarithm of an operator. - The methods
.set_data,.get_data,.extract_state,.eliminate_states,.evaluateand.check_isunitaryhave been removed. - The property
dtypereturn the representation of the data used. - The new
data_asallow to obtain the data as a common python formats: numpy array, scipy sparse matrix, JAX Array, etc.
QobjEvo changes
The QobjEvo type for storing time-dependent quantum objects has been
significantly expanded, standardized and extended. The time-dependent
coefficients are now represented using a new Coefficient type that
may be independently created and manipulated if required.
Some highlights:
- The
.compile()method has been removed. Coefficients specified as strings are automatically compiled if possible and the compilation is cached across different Python runs and instances. - Mixing coefficient types within a single
Qobjis now supported. - Many new attributes were added to
QobjEvofor convenience. Examples include.dims,.shape,.superrepand.isconstant. - Many old attributes such as
.cte,.use_cython,.type,.const, and.coeff_filewere removed. - A new
Splinecoefficient supports spline interpolations of different orders. The oldCubic_Splinecoefficient has been removed. - The new
.arguments(...)method allows additional arguments to the underlying coefficient functions to be updated. - The
_step_func_coeffargument has been replaced by theorderparameter._step_func_coeff=Falseis equivalent toorder=3._step_func_coeff=Trueis equivalent toorder=0. Higher values ofordergives spline interpolations of higher orders. - The spline type can take
bc_typeto control the boundary conditions. - QobjEvo can be creating from the multiplication of a Qobj with a coefficient:
oper * qutip.coefficient(f, args=args)is equivalent toqutip.QobjEvo([[oper, f]], args=args). - Coefficient function can be defined in a pythonic manner:
def f(t, A, w). The dictionaryargssecond argument is no longer needed. Function using the exactf(t, args)signature will use the old method for backward compatibility.
Solver changes
The solvers in QuTiP have been heavily reworked and standardized.
Under the hood solvers now make use of swappable ODE Integrators.
Many Integrators are included (see the list below) and
custom implementations are possible. Solvers now consistently
accept a QobjEvo instance at the Hamiltonian or Liouvillian, or
any object which can be passed to the QobjEvo constructor.
A breakdown of highlights follows.
All solvers:
- Solver options are now supplied in an ordinary Python dict.
qutip.Optionsis deprecated and returns a dict for backwards compatibility. - A specific ODE integrator may be selected by supplying a
methodoption. - Each solver provides a class interface. Creating an instance of the class allows a solver to be run multiple times for the same system without having to repeatedly reconstruct the right-hand side of the ODE to be integrated.
- A
QobjEvoinstance is accepted for most operators, e.g.,H,c_ops,e_ops,a_ops. - The progress bar is now selected using the
progress_baroption. A new progess bar using thetqdmPython library is provided. - Dynamic arguments, where the value of an operator depends on
the current state of the evolution interface reworked. Now a property of the
solver is to be used as an arguments:
args={"state": MESolver.StateFeedback(default=rho0)}
Integrators:
- The SciPy zvode integrator is available with the BDF and
Adams methods as
bdfandadams. - The SciPy dop853 integrator (an eighth order Runge-Kutta method by
Dormand & Prince) is available as
dop853. - The SciPy lsoda integrator is available as
lsoda. - QuTiP's own implementation of Verner's "most efficient" Runge-Kutta methods
of order 7 and 9 are available as
vern7andvern9. See http://people.math.sfu.ca/~jverner/ for a description of the methods. - QuTiP's own implementation of a solver that directly diagonalizes the
the system to be integrated is available as
diag. It only works on time-independent systems and is slow to setup, but once the diagonalization is complete, it generates solutions very quickly. - QuTiP's own implementatoin of an approximate Krylov subspace integrator is
available as
krylov. This integrator is only usable withsesolve.
Result class:
- A new
.e_dataattribute provides expectation values as a dictionary. Unlike.expect, the values are provided in a Python list rather than a numpy array, which better supports non-numeric types. - The contents of the
.statsattribute changed significantly and is now more consistent across solvers.
Monte-Carlo Solver (mcsolve):
- The system, H, may now be a super-operator.
- The
seedparameter now supports supplying numpySeedSequenceorGeneratortypes. - The new
timeoutandtarget_tolparameters allow the solver to exit early if a timeout or target tolerance is reached. - The ntraj option no longer supports a list of numbers of trajectories.
Instead, just run the solver multiple times and use the class
MCSolverif setting up the solver uses a significant amount of time. - The
map_funcparameter has been replaced by themapoption. - A loky based parallel map as been added.
- A mpi based parallel map as been added.
- The result returned by
mcsolvenow supports calculating photocurrents and calculating the steady state over N trajectories. - The old
parforparallel execution function has been removed fromqutip.parallel. Useparallel_map,loky_mapormpi_pmapinstead. - Added improved sampling options which converge much faster when the probability of collapse is small.
Non Markovian Monte-Carlo Solver (nm_mcsolve):
- New Monte-Carlo Solver supporting negative decay rates.
- Based on the influence martingale approach, Donvil et al., Nat Commun 13, 4140 (2022).
- Most of the improvements made to the regular Monte-Carlo solver are also available here.
- The value of the influence martingale is available through the
.traceattribute of the result.
Stochastic Equation Solvers (ssesolve, smesolve)
- Function call greatly changed: many keyword arguments are now options.
- m_ops and dW_factors are now changed from the default from the new class interface only.
- Use the same parallel maps as mcsolve: support for loky and mpi map added.
- End conditions
timeoutandtarget_toladded. - The
seedparameter now supports supplying numpySeedSequence. - Wiener function is now available as a feedback.
Bloch-Redfield Master Equation Solver (brmesolve):
- The
a_opsandspectrasupport implementations been heavily reworked to reuse the techniques from the new Coefficient and QobjEvo classes. - The
use_secularparameter has been removed. Usesec_cutoff=-1instead. - The required tolerance is now read from
qutip.settings.
Krylov Subspace Solver (krylovsolve):
- The Krylov solver is now implemented using
SESolverand thekrylovODE integrator. The functionkrylovsolveis maintained for convenience and now supports many more options. - The
sparseparameter has been removed. Supply a sparseQobjfor the Hamiltonian instead.
Floquet Solver (fsesolve and fmmesolve):
- The Floquet solver has been rewritten to use a new
FloquetBasisclass which manages the transformations from lab to Floquet basis and back. - Many of the internal methods used by the old Floquet solvers have
been removed. The Floquet tensor may still be retried using
the function
floquet_tensor. - The Floquet Markov Master Equation solver has had many changes and
new options added. The environment temperature may be specified using
w_th, and the result states are stored in the lab basis and optionally in the Floquet basis usingstore_floquet_state. - The spectra functions supplied to
fmmesolvemust now be vectorized (i.e. accept and return numpy arrays for frequencies and densities) and must accept negative frequence (i.e. usually include aw > 0factor so that the returned densities are zero for negative frequencies). - The number of sidebands to keep,
kmaxmay only be supplied when using theFMESolver - The
Tstepsparameter has been removed from bothfsesolveandfmmesolve. Theprecomputeoption toFloquetBasismay be used instead.
Evolution of State Solver (essovle):
- The function
essolvehas been removed. Use thediagintegration method withsesolveormesolveinstead.
Steady-state solvers (steadystate module):
- The
methodparameter andsolverparameters have been separated. Previously they were mixed together in themethodparameter. - The previous options are now passed as parameters to the steady state solver and mostly passed through to the underlying SciPy functions.
- The logging and statistics have been removed.
Correlation functions (correlation module):
- A new
correlation_3opfunction has been added. It supportsMESolverorBRMESolver. - The
correlation,correlation_4op, andcorrelation_ssfunctions have been removed. - Support for calculating correlation with
mcsolvehas been removed.
Propagators (propagator module):
- A class interface,
qutip.Propagator, has been added for propagators. - Propagation of time-dependent systems is now supported using
QobjEvo. - The
unitary_modeandparalleloptions have been removed.
Correlation spectra (spectrum module):
- The functions
spectrum_ssandspectrum_pihave been removed and are now internal functions. - The
use_pinvparameter forspectrumhas been removed and the functionality merged into thesolverparameter. Usesolver="pi"instead.
Hierarchical Equation of Motion Solver (HEOM)
- Updated the solver to use the new QuTiP integrators and data layer.
- Updated all the HEOM tutorials to QuTiP 5.
- Added support for combining bosonic and fermionic baths.
- Sped up the construction of the RHS of the HEOM solver by a factor of 4x.
- As in QuTiP 4, the HEOM supports arbitrary spectral densities, bosonic and fermionic baths, Páde and Matsubara expansions of the correlation functions, calculating the Matsubara terminator and inspection of the ADOs (auxiliary density operators).
QuTiP core
There have been numerous other small changes to core QuTiP features:
qft(...)the function that returns the quantum Fourier transform operator was moved fromqutip.qip.algorithmintoqutip.- The Bloch-Redfield solver tensor,
brtensor, has been moved intoqutip.core. See the section above on the Bloch-Redfield solver for details. - The functions
mat2vecandvec2matfor transforming states to and from super-operator states have been renamed tostack_columnsandunstack_columns. - The function
liouvillian_refhas been removed. Usedliouvillianinstead. - The superoperator transforms
super_to_choi,choi_to_super,choi_to_kraus,choi_to_chiandchi_to_choihave been removed. Usedto_choi,to_super,to_krausandto_chiinstead. - All of the random object creation functions now accepted a
numpy
Generatoras a seed. - The
dimsparameter of all random object creation functions has been removed. Supply the dimensions as the first parameter if explicit dimensions are required. - The function
rand_unitary_haarhas been removed. Userand_unitary(distribution="haar")instead. - The functions
rand_dm_hsandrand_dm_ginibrehave been removed. Userand_dm(distribution="hs")andrand_dm(distribution="ginibre")instead. - The function
rand_ket_haarhas been removed. Userand_ket(distribution="haar")instead. - The measurement functions have had the
targetparameter for expanding the measurement operator removed. Usedexpand_operatorto expand the operator instead. qutip.Blochnow supports applying colours per-point, state or vector inadd_point,add_states, andadd_vectors.- Dimensions use a class instead of layered lists.
- Allow measurement functions to support degenerate operators.
- Add
qeye_likeandqzero_like. - Added fermionic annihilation and creation operators.
QuTiP settings
Previously qutip.settings was an ordinary module. Now qutip.settings is
an instance of a settings class. All the runtime modifiable settings for
core operations are in qutip.settings.core. The other settings are not
modifiable at runtime.
- Removed
load.resetandsavefunctions. - Removed
.debug,.fortran,.openmp_thresh. - New
.compilestores the compilation options for compiled coefficients. - New
.core["rtol"]core option gives the default relative tolerance used by QuTiP. - The absolute tolerance setting
.atolhas been moved to.core["atol"].
Visualization
- Added arguments to
plot_wignerandplot_wigner_fock_distributionto specify parameters forwigner. - Removed
Bloch3D. The same functionality is provided byBloch. - Added
fig,axandcmapkeyword arguments to all visualization functions. - Most visualization functions now respect the
colorblind_safesetting. - Added new functions to create animations from a list of
Qobjor directly from solver results with saved states.
Package reorganization
qutip.qiphas been moved into its own package, qutip-qip. Once installed, qutip-qip is available as eitherqutip.qiporqutip_qip. Some widely useful gates have been retained inqutip.gates.qutip.controlhas been moved to qutip-qtrl and once installed qutip-qtrl is available as eitherqutip.controlorqutip_qtrl. Note thatquitp_qtrlis provided primarily for backwards compatibility. Improvements to optimal control will take place in the newqutip_qocpackage.qutip.latticehas been moved into its own package, qutip-lattice. It is available from<https://github.com/qutip/qutip-lattice>.qutip.sparsehas been removed. It contained the old sparse matrix representation and is replaced by the new implementation inqutip.data.qutip.piqsfunctions are no longer available from thequtipnamespace. They are accessible fromqutip.piqsinstead.
Miscellaneous
- Support has been added for 64-bit integer sparse matrix indices, allowing
sparse matrices with up to 2**63 rows and columns. This support needs to
be enabled at compilation time by calling
setup.pyand passing--with-idxint-64.
Feature removals
- Support for OpenMP has been removed. If there is enough demand and a good plan for how to organize it, OpenMP support may return in a future QuTiP release.
- The
qutip.parforfunction has been removed. Usequtip.parallel_mapinstead. qutip.graphhas been removed and replaced by SciPy's graph functions.qutip.topologyhas been removed. It contained only one functionberry_curvature.- The
~/.qutip/qutiprcconfig file is no longer supported. It contained settings for the OpenMP support. - Deprecate
three_level_atom - Deprecate
orbital
Changes from QuTiP 5.0.0b1:
Features
- Add dtype to printed ouput of qobj (#2352 by Rochisha Agarwal)
Miscellaneous
- Allow scipy 1.12 to be used with qutip. (#2354 by Pieter Eendebak)
Files
qutip/qutip-v5.0.0.zip
Files
(4.4 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:580f9c172e575b84a93e306ae19bb945
|
4.4 MB | Preview Download |
Additional details
Related works
- Is supplement to
- Software: https://github.com/qutip/qutip/tree/v5.0.0 (URL)