__init__.py 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. """
  2. ====================================
  3. Linear algebra (:mod:`scipy.linalg`)
  4. ====================================
  5. .. currentmodule:: scipy.linalg
  6. Linear algebra functions.
  7. .. eventually, we should replace the numpy.linalg HTML link with just `numpy.linalg`
  8. .. seealso::
  9. `numpy.linalg <https://www.numpy.org/devdocs/reference/routines.linalg.html>`__
  10. for more linear algebra functions. Note that
  11. although `scipy.linalg` imports most of them, identically named
  12. functions from `scipy.linalg` may offer more or slightly differing
  13. functionality.
  14. Basics
  15. ======
  16. .. autosummary::
  17. :toctree: generated/
  18. inv - Find the inverse of a square matrix
  19. solve - Solve a linear system of equations
  20. solve_banded - Solve a banded linear system
  21. solveh_banded - Solve a Hermitian or symmetric banded system
  22. solve_circulant - Solve a circulant system
  23. solve_triangular - Solve a triangular matrix
  24. solve_toeplitz - Solve a toeplitz matrix
  25. matmul_toeplitz - Multiply a Toeplitz matrix with an array.
  26. det - Find the determinant of a square matrix
  27. norm - Matrix and vector norm
  28. lstsq - Solve a linear least-squares problem
  29. pinv - Pseudo-inverse (Moore-Penrose) using lstsq
  30. pinvh - Pseudo-inverse of hermitian matrix
  31. kron - Kronecker product of two arrays
  32. khatri_rao - Khatri-Rao product of two arrays
  33. tril - Construct a lower-triangular matrix from a given matrix
  34. triu - Construct an upper-triangular matrix from a given matrix
  35. orthogonal_procrustes - Solve an orthogonal Procrustes problem
  36. matrix_balance - Balance matrix entries with a similarity transformation
  37. subspace_angles - Compute the subspace angles between two matrices
  38. bandwidth - Return the lower and upper bandwidth of an array
  39. issymmetric - Check if a square 2D array is symmetric
  40. ishermitian - Check if a square 2D array is Hermitian
  41. LinAlgError
  42. LinAlgWarning
  43. Eigenvalue Problems
  44. ===================
  45. .. autosummary::
  46. :toctree: generated/
  47. eig - Find the eigenvalues and eigenvectors of a square matrix
  48. eigvals - Find just the eigenvalues of a square matrix
  49. eigh - Find the e-vals and e-vectors of a Hermitian or symmetric matrix
  50. eigvalsh - Find just the eigenvalues of a Hermitian or symmetric matrix
  51. eig_banded - Find the eigenvalues and eigenvectors of a banded matrix
  52. eigvals_banded - Find just the eigenvalues of a banded matrix
  53. eigh_tridiagonal - Find the eigenvalues and eigenvectors of a tridiagonal matrix
  54. eigvalsh_tridiagonal - Find just the eigenvalues of a tridiagonal matrix
  55. Decompositions
  56. ==============
  57. .. autosummary::
  58. :toctree: generated/
  59. lu - LU decomposition of a matrix
  60. lu_factor - LU decomposition returning unordered matrix and pivots
  61. lu_solve - Solve Ax=b using back substitution with output of lu_factor
  62. svd - Singular value decomposition of a matrix
  63. svdvals - Singular values of a matrix
  64. diagsvd - Construct matrix of singular values from output of svd
  65. orth - Construct orthonormal basis for the range of A using svd
  66. null_space - Construct orthonormal basis for the null space of A using svd
  67. ldl - LDL.T decomposition of a Hermitian or a symmetric matrix.
  68. cholesky - Cholesky decomposition of a matrix
  69. cholesky_banded - Cholesky decomp. of a sym. or Hermitian banded matrix
  70. cho_factor - Cholesky decomposition for use in solving a linear system
  71. cho_solve - Solve previously factored linear system
  72. cho_solve_banded - Solve previously factored banded linear system
  73. polar - Compute the polar decomposition.
  74. qr - QR decomposition of a matrix
  75. qr_multiply - QR decomposition and multiplication by Q
  76. qr_update - Rank k QR update
  77. qr_delete - QR downdate on row or column deletion
  78. qr_insert - QR update on row or column insertion
  79. rq - RQ decomposition of a matrix
  80. qz - QZ decomposition of a pair of matrices
  81. ordqz - QZ decomposition of a pair of matrices with reordering
  82. schur - Schur decomposition of a matrix
  83. rsf2csf - Real to complex Schur form
  84. hessenberg - Hessenberg form of a matrix
  85. cdf2rdf - Complex diagonal form to real diagonal block form
  86. cossin - Cosine sine decomposition of a unitary or orthogonal matrix
  87. .. seealso::
  88. `scipy.linalg.interpolative` -- Interpolative matrix decompositions
  89. Matrix Functions
  90. ================
  91. .. autosummary::
  92. :toctree: generated/
  93. expm - Matrix exponential
  94. logm - Matrix logarithm
  95. cosm - Matrix cosine
  96. sinm - Matrix sine
  97. tanm - Matrix tangent
  98. coshm - Matrix hyperbolic cosine
  99. sinhm - Matrix hyperbolic sine
  100. tanhm - Matrix hyperbolic tangent
  101. signm - Matrix sign
  102. sqrtm - Matrix square root
  103. funm - Evaluating an arbitrary matrix function
  104. expm_frechet - Frechet derivative of the matrix exponential
  105. expm_cond - Relative condition number of expm in the Frobenius norm
  106. fractional_matrix_power - Fractional matrix power
  107. Matrix Equation Solvers
  108. =======================
  109. .. autosummary::
  110. :toctree: generated/
  111. solve_sylvester - Solve the Sylvester matrix equation
  112. solve_continuous_are - Solve the continuous-time algebraic Riccati equation
  113. solve_discrete_are - Solve the discrete-time algebraic Riccati equation
  114. solve_continuous_lyapunov - Solve the continuous-time Lyapunov equation
  115. solve_discrete_lyapunov - Solve the discrete-time Lyapunov equation
  116. Sketches and Random Projections
  117. ===============================
  118. .. autosummary::
  119. :toctree: generated/
  120. clarkson_woodruff_transform - Applies the Clarkson Woodruff Sketch (a.k.a CountMin Sketch)
  121. Special Matrices
  122. ================
  123. .. autosummary::
  124. :toctree: generated/
  125. block_diag - Construct a block diagonal matrix from submatrices
  126. circulant - Circulant matrix
  127. companion - Companion matrix
  128. convolution_matrix - Convolution matrix
  129. dft - Discrete Fourier transform matrix
  130. fiedler - Fiedler matrix
  131. fiedler_companion - Fiedler companion matrix
  132. hadamard - Hadamard matrix of order 2**n
  133. hankel - Hankel matrix
  134. helmert - Helmert matrix
  135. hilbert - Hilbert matrix
  136. invhilbert - Inverse Hilbert matrix
  137. leslie - Leslie matrix
  138. pascal - Pascal matrix
  139. invpascal - Inverse Pascal matrix
  140. toeplitz - Toeplitz matrix
  141. tri - Construct a matrix filled with ones at and below a given diagonal
  142. Low-level routines
  143. ==================
  144. .. autosummary::
  145. :toctree: generated/
  146. get_blas_funcs
  147. get_lapack_funcs
  148. find_best_blas_type
  149. .. seealso::
  150. `scipy.linalg.blas` -- Low-level BLAS functions
  151. `scipy.linalg.lapack` -- Low-level LAPACK functions
  152. `scipy.linalg.cython_blas` -- Low-level BLAS functions for Cython
  153. `scipy.linalg.cython_lapack` -- Low-level LAPACK functions for Cython
  154. """ # noqa: E501
  155. from ._misc import *
  156. from ._cythonized_array_utils import *
  157. from ._basic import *
  158. from ._decomp import *
  159. from ._decomp_lu import *
  160. from ._decomp_ldl import *
  161. from ._decomp_cholesky import *
  162. from ._decomp_qr import *
  163. from ._decomp_qz import *
  164. from ._decomp_svd import *
  165. from ._decomp_schur import *
  166. from ._decomp_polar import *
  167. from ._matfuncs import *
  168. from .blas import *
  169. from .lapack import *
  170. from ._special_matrices import *
  171. from ._solvers import *
  172. from ._procrustes import *
  173. from ._decomp_update import *
  174. from ._sketches import *
  175. from ._decomp_cossin import *
  176. # Deprecated namespaces, to be removed in v2.0.0
  177. from . import (
  178. decomp, decomp_cholesky, decomp_lu, decomp_qr, decomp_svd, decomp_schur,
  179. basic, misc, special_matrices, flinalg, matfuncs
  180. )
  181. __all__ = [s for s in dir() if not s.startswith('_')]
  182. from scipy._lib._testutils import PytestTester
  183. test = PytestTester(__name__)
  184. del PytestTester