repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
scikit-bio
skbio/io/format/tests/test_fasta.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
1,096
48,483
scikit-bio
skbio/io/format/tests/test_phylip_dm.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
346
15,279
scikit-bio
skbio/io/format/tests/test_binary_dm.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
165
6,075
scikit-bio
skbio/io/tests/test_registry.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
1,765
58,616
scikit-bio
skbio/io/tests/test_util.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
641
23,864
scikit-bio
skbio/io/tests/test_descriptors.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
669
25,411
scikit-bio
skbio/io/tests/test_iosources.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
61
1,953
scikit-bio
skbio/io/tests/test_format_imports.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
150
5,565
scikit-bio
doc/metatag.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
69
2,023
scikit-bio
doc/suburl.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
53
1,610
scikit-bio
doc/editmap.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
48
1,064
scikit-bio
doc/source/conf.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
334
9,253
scikit-bio
doc/source/autoinherit.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
85
2,743
scikit-bio
web/suburl.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
53
1,629
scikit-bio
web/conf.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
121
3,170
qutip
setup.py
.py
import collections import os import pathlib import subprocess import sys import sysconfig import warnings # Required third-party imports, must be specified in pyproject.toml. import packaging.version from setuptools import setup, Extension import numpy as np from Cython.Build import cythonize from Cython.Distutils imp...
312
11,650
qutip
doc/conf.py
.py
# # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # import os import pathlib import warnings # -- General configuration ---------...
398
12,486
qutip
doc/guide/scripts/ex_steady.py
.py
import numpy as np import matplotlib.pyplot as plt import qutip # Define paramters N = 20 # number of basis states to consider a = qutip.destroy(N) H = a.dag() * a psi0 = qutip.basis(N, 10) # initial state kappa = 0.1 # coupling to oscillator # collapse operators c_op_list = [] n_th_a = 2 # temperature with aver...
46
1,417
qutip
doc/guide/scripts/bloch_ex1.py
.py
import numpy as np import qutip b = qutip.Bloch() th = np.linspace(0, 2*np.pi, 20) xp = np.cos(th) yp = np.sin(th) zp = np.zeros(20) xz = np.zeros(20) yz = np.sin(th) zz = np.cos(th) b.add_points([xp, yp, zp]) b.add_points([xz, yz, zz]) b.show()
18
250
qutip
doc/guide/scripts/spectrum_ex1.py
.py
import numpy as np from matplotlib import pyplot import qutip N = 4 # number of cavity fock states wc = wa = 1.0 * 2 * np.pi # cavity and atom frequency g = 0.1 * 2 * np.pi # coupling strength kappa = 0.75 # cavity dissipation rate gamma = 0.25 # atom dissipatio...
49
1,759
qutip
doc/guide/scripts/correlation_ex1.py
.py
import numpy as np import matplotlib.pyplot as plt import qutip times = np.linspace(0, 10, 200) a = qutip.destroy(10) x = a.dag() + a H = a.dag() * a corr1 = qutip.correlation_2op_1t(H, None, times, [np.sqrt(0.5) * a], x, x) corr2 = qutip.correlation_2op_1t(H, None, times, [np.sqrt(1.0) * a], x, x) corr3 = qutip.corr...
18
542
qutip
doc/guide/scripts/correlation_ex3.py
.py
import numpy as np import matplotlib.pyplot as plt import qutip N = 15 taus = np.linspace(0,10.0,200) a = qutip.destroy(N) H = 2 * np.pi * a.dag() * a # collapse operator G1 = 0.75 n_th = 2.00 # bath temperature in terms of excitation number c_ops = [np.sqrt(G1 * (1 + n_th)) * a, np.sqrt(G1 * n_th) * a.dag()] # sta...
34
980
qutip
doc/guide/scripts/floquet_ex3.py
.py
import numpy as np from matplotlib import pyplot import qutip delta = 0.0 * 2*np.pi eps0 = 1.0 * 2*np.pi A = 0.25 * 2*np.pi omega = 1.0 * 2*np.pi T = 2*np.pi / omega tlist = np.linspace(0.0, 20 * T, 301) psi0 = qutip.basis(2,0) H0 = - delta/2.0 * qutip.sigmax() - eps0/2.0 * qutip.sigmaz() H1 = A/2.0 * q...
53
1,600
qutip
doc/guide/scripts/ex_bloch_animation.py
.py
import numpy as np import qutip def qubit_integrate(w, theta, gamma1, gamma2, psi0, tlist): # operators and the hamiltonian sx = qutip.sigmax() sy = qutip.sigmay() sz = qutip.sigmaz() sm = qutip.sigmam() H = w * (np.cos(theta) * sz + np.sin(theta) * sx) # collapse operators c_op_list = ...
35
1,267
qutip
doc/guide/scripts/floquet_ex1.py
.py
import numpy as np from matplotlib import pyplot import qutip delta = 0.2 * 2*np.pi eps0 = 1.0 * 2*np.pi A = 0.5 * 2*np.pi omega = 1.0 * 2*np.pi T = (2*np.pi)/omega tlist = np.linspace(0.0, 10 * T, 101) psi0 = qutip.basis(2, 0) H0 = - delta/2.0 * qutip.sigmax() - eps0/2.0 * qutip.sigmaz() H1 = A/2.0 * q...
41
1,320
qutip
doc/guide/scripts/correlation_ex4.py
.py
import numpy as np import matplotlib.pyplot as plt import qutip N = 25 taus = np.linspace(0, 25.0, 200) a = qutip.destroy(N) H = 2 * np.pi * a.dag() * a kappa = 0.25 n_th = 2.0 # bath temperature in terms of excitation number c_ops = [np.sqrt(kappa * (1 + n_th)) * a, np.sqrt(kappa * n_th) * a.dag()] states = [ ...
39
1,102
qutip
doc/guide/scripts/correlation_ex2.py
.py
import numpy as np import matplotlib.pyplot as plt import qutip times = np.linspace(0, 10.0, 200) a = qutip.destroy(10) x = a.dag() + a H = a.dag() * a alpha = 2.5 rho0 = qutip.coherent_dm(10, alpha) corr = qutip.correlation_2op_2t(H, rho0, times, times, [np.sqrt(0.25) * a], x, x) plt.pcolor(np.real(corr)) plt.xlabel...
18
423
qutip
doc/guide/scripts/floquet_ex2.py
.py
import numpy as np from matplotlib import pyplot import qutip delta = 0.0 * 2*np.pi eps0 = 1.0 * 2*np.pi A = 0.25 * 2*np.pi omega = 1.0 * 2*np.pi T = 2*np.pi / omega tlist = np.linspace(0.0, 10 * T, 101) psi0 = qutip.basis(2,0) H0 = - delta/2.0 * qutip.sigmax() - eps0/2.0 * qutip.sigmaz() H1 = A/2.0 * q...
40
1,335
qutip
qutip/qip.py
.py
"""Module replicating the qutip_qip package from within qutip.""" import sys try: import qutip_qip del qutip_qip sys.modules["qutip.qip"] = sys.modules["qutip_qip"] except ImportError: raise ImportError( "Importing 'qutip.qip' requires the 'qutip_qip' package. Install it " "with `pip in...
14
416
qutip
qutip/partial_transpose.py
.py
__all__ = ['partial_transpose'] import numpy as np import scipy.sparse as sp from . import ( Qobj, state_index_number, state_number_index, state_number_enumerate, ) from .core.dimensions import flatten def partial_transpose(rho, mask, method='dense'): """ Return the partial transpose of a Qobj instance ...
122
3,622
qutip
qutip/animation.py
.py
""" Functions to animate results of quantum dynamics simulations, """ __all__ = ['anim_wigner_sphere', 'anim_hinton', 'anim_sphereplot', 'anim_matrix_histogram', 'anim_fock_distribution', 'anim_wigner', 'anim_spin_distribution', 'anim_qubism', 'anim_schmidt', 'anim_qfunc'] from . impor...
639
21,100
qutip
qutip/random_objects.py
.py
""" This module is a collection of random state and operator generators. """ __all__ = [ 'rand_herm', 'rand_unitary', 'rand_dm', 'rand_stochastic', 'rand_ket', 'rand_kraus_map', 'rand_super', "rand_super_bcsz", ] import numpy as np from numpy.random import Generator, SeedSequence, defa...
907
31,664
qutip
qutip/entropy.py
.py
__all__ = ['entropy_vn', 'entropy_linear', 'entropy_mutual', 'negativity', 'concurrence', 'entropy_conditional', 'entangling_power', 'entropy_relative'] from .core.numpy_backend import np from .partial_transpose import partial_transpose from . import (ptrace, tensor, sigmay, ket2dm, ...
386
11,101
qutip
qutip/measurement.py
.py
""" Module for measuring quantum objects. """ __all__ = [ 'measurement_statistics_povm', 'measurement_statistics_observable', 'measure_observable', 'measure_povm', 'measurement_statistics', 'measure' ] import numpy as np from . import Qobj, expect, qeye_like, settings def _verify_input(op, ...
448
14,593
qutip
qutip/visualization.py
.py
""" Functions for visualizing results of quantum dynamics simulations, visualizations of quantum states and processes. """ __all__ = ['plot_wigner_sphere', 'hinton', 'sphereplot', 'matrix_histogram', 'plot_energy_levels', 'plot_fock_distribution', 'plot_wigner', 'plot_qfunc', 'plot_expectation_va...
2,115
65,494
qutip
qutip/distributions.py
.py
""" This module provides classes and functions for working with spatial distributions, such as Wigner distributions, etc. .. note:: Experimental. """ __all__ = ['Distribution', 'HarmonicOscillatorWaveFunction', 'HarmonicOscillatorProbabilityFunction'] import numpy as np from numpy.typing import Arra...
533
18,209
qutip
qutip/fileio.py
.py
__all__ = ['file_data_store', 'file_data_read', 'qsave', 'qload'] import pickle import numpy as np from .core import Qobj from pathlib import Path # ----------------------------------------------------------------------------- # Write matrix data to a file # def file_data_store(filename, data, numtype="complex", num...
236
7,117
qutip
qutip/ipynbtools.py
.py
""" This module contains utility functions for using QuTiP with IPython notebooks. """ from qutip.ui.progressbar import HTMLProgressBar from .settings import _blas_info, available_cpu_count import IPython from IPython.display import HTML, display import matplotlib.pyplot as plt from matplotlib import animation from ba...
317
10,033
qutip
qutip/utilities.py
.py
""" This module contains utility functions that are commonly needed in other qutip modules. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['n_thermal', 'clebsch', 'convert_unit', 'iterated_fit'] import math from fractions import Fraction from typing import Call...
1,019
31,492
qutip
qutip/bloch.py
.py
__all__ = ['Bloch'] from pathlib import Path from typing import Literal import numpy as np from numpy import cos, ones, outer, sin from packaging.version import parse as parse_version from . import Qobj, expect, sigmax, sigmay, sigmaz try: import matplotlib import matplotlib.pyplot as plt from matplotli...
1,055
40,243
qutip
qutip/matplotlib_utilities.py
.py
""" This module contains utility functions that enhance Matplotlib in one way or another. """ __all__ = ['wigner_cmap', 'MidpointNorm', 'complex_phase_cmap'] import numpy as np try: import matplotlib as mpl from matplotlib import cm from matplotlib.colors import Normalize, ColorConverter except ImportEr...
156
5,594
qutip
qutip/wigner.py
.py
__all__ = [ 'wigner', 'qfunc', 'QFunc', 'spin_q_function', 'spin_wigner', 'wigner_transform', ] import numpy as np import warnings from numpy import ( zeros, array, arange, exp, real, conj, pi, copy, sqrt, meshgrid, cos, sin, ) import scipy.sparse as sp import scipy.fftpack as ft import scipy.linalg as la ...
1,111
38,676
qutip
qutip/testing.py
.py
from .about import about from .settings import settings as qset def run(full=False): """ Run the test scripts for QuTiP. Parameters ---------- full: bool If True run all test (30 min). Otherwise skip few variants of the slowest tests. """ # Call about to get all version inf...
35
1,016
qutip
qutip/continuous_variables.py
.py
""" This module contains a collection functions for calculating continuous variable quantities from fock-basis representation of the state of multi-mode fields. """ __all__ = ['correlation_matrix', 'covariance_matrix', 'correlation_matrix_field', 'correlation_matrix_quadrature', 'wigner_covarianc...
260
8,524
qutip
qutip/control.py
.py
"""Module replicating the qutip_qtrl package from within qutip.""" import sys try: import qutip_qtrl del qutip_qtrl sys.modules["qutip.control"] = sys.modules["qutip_qtrl"] except ImportError: raise ImportError( "Importing 'qutip.control' requires the 'qutip_qtrl' package. " "Install it...
14
431
qutip
qutip/tomography.py
.py
__all__ = ['qpt_plot', 'qpt_plot_combined', 'qpt'] from numpy import hstack, real, imag import scipy.linalg as la from . import tensor, spre, spost, stack_columns, unstack_columns from .visualization import matrix_histogram import itertools try: import matplotlib.pyplot as plt except ImportError: pass def _...
190
5,326
qutip
qutip/cite.py
.py
""" Citation generator for QuTiP """ from pathlib import Path __all__ = ['cite'] def cite(save=False, path=None): """ Citation information and bibtex generator for QuTiP Parameters ---------- save: bool The flag specifying whether to save the .bib file. path: str The complet...
55
1,413
qutip
qutip/settings.py
.py
""" This module contains settings for the QuTiP graphics, multiprocessing, and tidyup functionality, etc. """ import os import sys from ctypes import cdll, CDLL import platform from glob import glob from pathlib import Path import numpy as np import scipy __all__ = ['settings'] def _blas_info_pre_1_26(): config ...
362
10,593
qutip
qutip/typing.py
.py
from typing import Sequence, Union, Any, Protocol, Callable, TypeVar from numbers import Number, Real import numpy as np import scipy.interpolate __all__ = ["QobjEvoLike", "CoefficientLike", "LayerType"] class QEvoProtocol(Protocol): def __call__(self, t: Real, **kwargs) -> "Qobj": ... class CoeffProt...
56
1,050
qutip
qutip/about.py
.py
""" Command line output of information on QuTiP and dependencies. """ __all__ = ['about'] import sys import importlib.metadata import platform from pathlib import Path import numpy import scipy import inspect import qutip from qutip.settings import _blas_info, settings def about(): """ About box for QuTiP. G...
99
3,147
qutip
qutip/simdiag.py
.py
__all__ = ['simdiag'] import numpy as np import scipy.linalg as la from . import Qobj from .core import data as _data def _degen(tol, vecs, ops, i=0): """ Private function that finds eigen vals and vecs for degenerate matrices.. """ if len(ops) == i: return vecs # New eigenvectors are so...
135
4,334
qutip
qutip/solver/options.py
.py
__all__ = [] import warnings import weakref class _SolverOptions(dict): """ Class to hold options for solver and integrator. Parameters ---------- default : dict Default dict, only keys in this will be accepted. on_update : callable, ``f(keys : set) -> None``, optional Functi...
117
3,472
qutip
qutip/solver/brmesolve.py
.py
""" This module provides solvers for the Lindblad master equation and von Neumann equation. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['brmesolve', 'BRSolver'] from typing import Any import warnings import numpy as np from numpy.typing import ArrayLike impor...
419
15,988
qutip
qutip/solver/mesolve.py
.py
""" This module provides solvers for the Lindblad master equation and von Neumann equation. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['mesolve', 'MESolver'] from numpy.typing import ArrayLike from typing import Any from time import time from .. import Qobj...
306
11,773
qutip
qutip/solver/_feedback.py
.py
from qutip.core.cy.qobjevo import QobjEvo, _Feedback from qutip.core.dimensions import Dimensions, Field, SuperSpace import qutip.core.data as _data from qutip.core.qobj import Qobj import numpy as np class _ExpectFeedback(_Feedback): def __init__(self, oper, default=0.): self.oper = QobjEvo(oper) ...
151
4,542
qutip
qutip/solver/floquet.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = [ "FloquetBasis", "floquet_tensor", "fsesolve", "fmmesolve", "FMESolver", ] from typing import Any, overload, TypeVar, Literal, Callable import warnings import numpy as np from numpy.typing import Arr...
1,045
33,994
qutip
qutip/solver/sesolve.py
.py
""" This module provides solvers for the unitary Schrodinger equation. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['sesolve', 'SESolver'] from numpy.typing import ArrayLike from time import time from typing import Any, Callable from .. import Qobj, QobjEvo f...
239
8,749
qutip
qutip/solver/parallel.py
.py
""" This module provides functions for parallel execution of loops and function mappings, using the builtin Python module multiprocessing or the loky parallel execution library. """ __all__ = ['parallel_map', 'serial_map', 'loky_pmap', 'mpi_pmap'] import multiprocessing import os import sys import time import threadin...
560
21,085
qutip
qutip/solver/solver_base.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['Solver'] from numpy.typing import ArrayLike from numbers import Number from typing import Any, Callable from .. import Qobj, QobjEvo, ket2dm from .options import _SolverOptions from ..core import stack_columns, unstack...
513
17,920
qutip
qutip/solver/krylovsolve.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['krylovsolve'] from .. import QobjEvo, Qobj from .mesolve import mesolve from .result import Result from numpy.typing import ArrayLike from qutip.typing import QobjEvoLike from typing import Any, Callable def krylovso...
128
5,356
qutip
qutip/solver/spectrum.py
.py
__all__ = ['spectrum', 'spectrum_correlation_fft'] import numpy as np import scipy.fftpack from .steadystate import steadystate from ..core import liouvillian, spre, expect from ..core import data as _data from qutip.settings import settings def spectrum(H, wlist, c_ops, a_op, b_op, solver="es"): r""" Calcul...
189
6,193
qutip
qutip/solver/multitraj.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations from .result import Result from .multitrajresult import MultiTrajResult from .parallel import _get_map from time import time from .solver_base import Solver from ..core import QobjEvo, Qobj from ..core.numpy_backend import np from ...
524
20,126
qutip
qutip/solver/result.py
.py
""" Class for solve function results""" # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations from typing import TypedDict, Any, Callable from ..core.numpy_backend import np from numpy.typing import ArrayLike from ..core import Qobj, QobjEvo, expect __all__ = ["Result"] class _Qob...
523
16,829
qutip
qutip/solver/floquet_bwcomp.py
.py
""" Floquet solver compatibility functions that behave like the corresponding functions from QuTiP 4.7. These functions are indented to be used when porting code from QuTiP 4.7 to QuTiP 5. They are deprecated and will be removed in QuTiP 5.1. """ __all__ = [ "floquet_modes", "floquet_modes_t", "floquet_mo...
245
7,660
qutip
qutip/solver/countstat.py
.py
""" This module contains functions for calculating current and current noise using the counting statistics formalism. """ __all__ = ['countstat_current', 'countstat_current_noise'] import numpy as np from itertools import product from ..core import ( sprepost, spre, qeye_like, Qobj, operator_to_vector, CoreOption...
333
11,304
qutip
qutip/solver/scattering.py
.py
""" Photon scattering in quantum optical systems This module includes a collection of functions for numerically computing photon scattering in driven arbitrary systems coupled to some configuration of output waveguides. The implementation of these functions closely follows the mathematical treatment given in K.A. Fisc...
303
11,346
qutip
qutip/solver/mcsolve.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['mcsolve', "MCSolver"] from ..core.numpy_backend import np from numpy.typing import ArrayLike from numpy.random import SeedSequence from time import time from typing import Any import warnings from .. import settings f...
986
39,590
qutip
qutip/solver/dysolve_propagator.py
.py
from qutip import Qobj, qeye_like from .cy.dysolve import cy_compute_integrals from numpy.typing import ArrayLike import numpy as np import scipy as sp from numbers import Number import itertools __all__ = ['DysolvePropagator', 'dysolve_propagator'] class DysolvePropagator: """ A generator of propagator usi...
373
10,952
qutip
qutip/solver/stochastic.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ["smesolve", "SMESolver", "ssesolve", "SSESolver"] import numpy as np from numpy.typing import ArrayLike from numpy.random import SeedSequence from typing import Any, Callable, Literal, overload from functools import par...
1,136
41,390
qutip
qutip/solver/steadystate.py
.py
from qutip import liouvillian, lindblad_dissipator, Qobj, qzero_like, qeye_like from qutip import vector_to_operator, operator_to_vector, hilbert_dist from qutip import settings, CoreOptions import qutip.core.data as _data import numpy as np import scipy.sparse.csgraph import scipy.sparse.linalg from warnings import wa...
613
21,055
qutip
qutip/solver/propagator.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['Propagator', 'propagator', 'propagator_steadystate'] import numbers import numpy as np from .. import Qobj, qeye, qeye_like, unstack_columns, QobjEvo, liouvillian from ..core import data as _data from ..typing import ...
435
14,504
qutip
qutip/solver/correlation.py
.py
__all__ = [ 'correlation_3op', 'correlation_2op_1t', 'correlation_2op_2t', 'correlation_3op_1t', 'correlation_3op_2t', 'coherence_function_g1', 'coherence_function_g2' ] import numpy as np from ..core import ( Qobj, QobjEvo, liouvillian, spre, unstack_columns, stack_columns, tensor, expect, qeye_l...
631
23,204
qutip
qutip/solver/nm_mcsolve.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['nm_mcsolve', 'NonMarkovianMCSolver'] import numbers from typing import Any from collections.abc import Sequence import numpy as np from numpy.typing import ArrayLike from numpy.random import SeedSequence import scipy ...
687
27,288
qutip
qutip/solver/multitrajresult.py
.py
""" This module provides result classes for multi-trajectory solvers. Note that single trajectories are described by regular `Result` objects from the `qutip.solver.result` module. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations from typing import TypedDict from ..core.numpy...
1,796
64,101
qutip
qutip/solver/heom/bofin_baths.py
.py
""" This module provides utilities for describing baths when using the HEOM (hierarchy equations of motion) to model system-bath interactions. See the ``qutip.nonmarkov.bofin_solvers`` module for the associated solver. The implementation is derived from the BoFiN library (see https://github.com/tehruhn/bofin) which wa...
803
29,136
qutip
qutip/solver/heom/__init__.py
.py
""" This module provides solvers for system-bath evolution using the HEOM (hierarchy equations of motion). See https://en.wikipedia.org/wiki/Hierarchical_equations_of_motion for a very basic introduction to the technique. The implementation is derived from the BoFiN library (see https://github.com/tehruhn/bofin) whic...
56
1,314
qutip
qutip/solver/heom/bofin_solvers.py
.py
""" This module provides solvers for system-bath evoluation using the HEOM (hierarchy equations of motion). See https://en.wikipedia.org/wiki/Hierarchical_equations_of_motion for a very basic introduction to the technique. The implementation is derived from the BoFiN library (see https://github.com/tehruhn/bofin) whi...
1,411
52,376
qutip
qutip/solver/integrator/integrator.py
.py
""" `Integrator`: ODE solver wrapper to use in qutip's Solver """ import numpy as np from collections.abc import Iterator, Callable from qutip.core import QobjEvo from ._rhs import RHS from qutip.core.data import Data __all__ = ['Integrator', 'IntegratorException'] class IntegratorException(Exception): """Error ...
241
7,804
qutip
qutip/solver/integrator/verner7efficient.py
.py
""" Provide a cython implimentation verner 'most-efficient' order 7 runge-Kutta method. See https://www.sfu.ca/~jverner/ """ # Verner 7 Efficient # https://www.sfu.ca/~jverner/RKV76.IIa.Efficient.00001675585.081206.CoeffsOnlyFLOAT __all__ = ["vern7_coeff"] import numpy as np order = 7 rk_step = 10 rk_extra_step = 16 de...
334
11,985
qutip
qutip/solver/integrator/krylov.py
.py
import numpy as np from qutip.core import data as _data from ..integrator import IntegratorException, Integrator from ..sesolve import SESolver from ..mesolve import MESolver __all__ = ["IntegratorKrylov"] class IntegratorKrylov(Integrator): """ Evolve the state ("rho0") finding an approximation for the tim...
345
12,577
qutip
qutip/solver/integrator/tsit5.py
.py
""" Tsitouras's 5/4 order Runge-Kutta method Runge–Kutta pairs of order 5(4) satisfying only the first column simplifying assumption, Ch. Tsitouras, Computers & Mathematics with Applications, Vol 62, Issue 2, 770-775 Jan 2011 """ __all__ = ["tsit5_coeff"] import numpy as np order = 5 rk_step = 7 a = np.zeros((rk_ste...
104
2,241
qutip
qutip/solver/integrator/qutip_integrator.py
.py
from ..integrator import IntegratorException, Integrator from ..solver_base import Solver from .explicit_rk import Explicit_RungeKutta import numpy as np from qutip import data as _data from .verner7efficient import vern7_coeff from .verner9efficient import vern9_coeff from .tsit5 import tsit5_coeff __all__ = [ 'I...
256
7,667
qutip
qutip/solver/integrator/verner9efficient.py
.py
""" Provide a cython implimentation verner 'most-efficient' order 9 runge-Kutta method. See https://www.sfu.ca/~jverner/ """ # Verner 9 Efficient # https://www.sfu.ca/~jverner/ __all__ = ["vern9_coeff"] import numpy as np order = 9 rk_step = 16 rk_extra_step = 26 denseout_order = 9 bh = np.zeros(rk_step, dtype=np.flo...
707
24,555
qutip
qutip/solver/integrator/scipy_integrator.py
.py
"""ODE integrator from scipy.""" __all__ = [ 'IntegratorScipyAdams', 'IntegratorScipyBDF', 'IntegratorScipyDop853', 'IntegratorScipylsoda', ] import numpy as np from scipy.integrate import ode from scipy.integrate._ode import zvode from qutip.core import data as _data from qutip.core.data.reshape impo...
537
18,739
qutip
qutip/solver/sode/sode.py
.py
import numpy as np import warnings from . import _sode from ..integrator.integrator import Integrator from ..stochastic import StochasticSolver, SMESolver from ._noise import Wiener, PreSetWiener __all__ = ["SIntegrator", "PlatenSODE", "PredCorr_SODE"] class SIntegrator(Integrator): """ A wrapper around stoc...
312
9,356
qutip
qutip/solver/sode/rouchon.py
.py
import numpy as np import warnings from qutip import unstack_columns, stack_columns from qutip.core import data as _data from ..stochastic import StochasticSolver from .sode import SIntegrator from ..integrator.integrator import Integrator from ._noise import Wiener __all__ = ["RouchonSODE"] class RouchonSODE(SInte...
206
6,638
qutip
qutip/solver/sode/_noise.py
.py
import numpy as np __all__ = ["Wiener", "PreSetWiener"] class Wiener: """ Wiener process. """ def __init__(self, t0, dt, generator, shape): self.t0 = t0 self.dt = dt self.shape = shape self.generator = generator self.noise = np.zeros((0,) + shape, dtype=float) ...
145
4,447
qutip
qutip/solver/sode/itotaylor.py
.py
from . import _sode from .sode import _Explicit_Simple_Integrator, _Implicit_Simple_Integrator from ..stochastic import StochasticSolver, SMESolver __all__ = [ "EulerSODE", "Milstein_SODE", "Taylor1_5_SODE", "Explicit1_5_SODE", "Implicit_Milstein_SODE", "Implicit_Taylor1_5_SODE" ] class EulerSODE(_Explicit_...
171
5,193
qutip
qutip/solver/nonmarkov/transfertensor.py
.py
# @author: Arne L. Grimsmo # @email1: arne.grimsmo@gmail.com # @organization: University of Sherbrooke """ This module contains an implementation of the non-Markovian transfer tensor method (TTM), introduced in [1]. [1] Javier Cerrillo and Jianshu Cao, Phys. Rev. Lett 112, 110401 (2014) """ import numpy as np import...
176
5,420
qutip
qutip/core/direct_sum.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations from . import data as _data from .cy.qobjevo import QobjEvo from .dimensions import Dimensions, Field, SumSpace from .operators import qzero from .qobj import Qobj from .superoperator import operator_to_vector from .. import setti...
704
25,315
qutip
qutip/core/options.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations from ..settings import settings from .numpy_backend import np as qt_np import numpy from typing import overload, Literal, Any import types __all__ = ["CoreOptions"] class QutipOptions: """ Class for basic functionality f...
269
8,893
qutip
qutip/core/blochredfield.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations import os import inspect import numpy as np from typing import overload, Union from qutip.settings import settings as qset from . import Qobj, QobjEvo, liouvillian, coefficient, sprepost from ._brtools import SpectraCoefficient, _...
428
15,144
qutip
qutip/core/numpy_backend.py
.py
from ..settings import settings class NumpyBackend: __slots__ = ( "_qt_np", "abs", "angle", "arccos", "array", "ceil", "conj", "cos", "cumsum", "diff", "e", "histogram", "imag", "inf", "inner", ...
52
934
qutip
qutip/core/tensor.py
.py
""" Module for the creation of composite quantum objects via the tensor product. """ __all__ = [ 'tensor', 'super_tensor', 'composite', 'tensor_swap', 'tensor_contract', 'expand_operator' ] from collections.abc import Iterable from functools import partial from typing import TypeVar, overload import numpy as ...
518
17,164
qutip
qutip/core/environment.py
.py
""" Classes that describe environments of open quantum systems """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['BosonicEnvironment', 'DrudeLorentzEnvironment', 'UnderDampedEnvironment', 'OhmicEnvironment', 'ExponentialB...
3,039
100,827
qutip
qutip/core/superoperator.py
.py
__all__ = [ 'liouvillian', 'lindblad_dissipator', 'operator_to_vector', 'vector_to_operator', 'stack_columns', 'unstack_columns', 'stacked_index', 'unstacked_index', 'spost', 'spre', 'sprepost', 'reshuffle', 'scommutator', 'santicommutator' ] import functools from typing import TypeVar, overload import...
598
19,322
qutip
qutip/core/local_matmul.py
.py
from .qobj import Qobj from .data.local_matmul import target_mode_matmul, target_mode_matmul_super __all__ = ["local_matmul"] def local_matmul( operator: Qobj, state: Qobj, modes: int | list[int], dual: bool = False ) -> Qobj: """ Applies an operator to specific modes of a quantum state or o...
188
6,372
qutip
qutip/core/superop_reps.py
.py
# # This module was initially contributed by Ben Criger. # """ This module implements transformations between superoperator representations, including supermatrix, Kraus, Choi and Chi (process) matrix formalisms. """ from __future__ import annotations __all__ = [ 'kraus_to_choi', 'kraus_to_super', 'to_superpauli',...
613
19,894
qutip
qutip/core/operators.py
.py
""" This module contains functions for generating Qobj representation of a variety of commonly occuring quantum operators. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = [ 'jmat', 'spin_Jx', 'spin_Jy', 'spin_Jz', 'spin_Jm', 'spin_Jp', 'spin_J_set', 'sigmap...
1,317
35,255
qutip
qutip/core/semidefinite.py
.py
""" This module implements internal-use functions for semidefinite programming. """ import collections import functools import numpy as np import scipy.sparse as sp # Conditionally import CVXPY try: import cvxpy __all__ = ["dnorm_problem", "dnorm_sparse_problem"] except ImportError: cvxpy = None __al...
162
4,886