Skip to content

Commit 3cf092b

Browse files
WarrenWeckessermattip
authored andcommitted
DOC: linalg: Include information about scipy.linalg. (numpy#14988)
* DOC: Add links to scipy linalg fuctions and compare numpy.linalg vs scipy.linalg.
1 parent 6d69a9e commit 3cf092b

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

doc/source/reference/routines.linalg.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ or specify the processor architecture.
1818
.. _OpenBLAS: https://www.openblas.net/
1919
.. _threadpoolctl: https://github.com/joblib/threadpoolctl
2020

21+
The SciPy library also contains a `~scipy.linalg` submodule, and there is
22+
overlap in the functionality provided by the SciPy and NumPy submodules. SciPy
23+
contains functions not found in `numpy.linalg`, such as functions related to
24+
LU decomposition and the Schur decomposition, multiple ways of calculating the
25+
pseudoinverse, and matrix transcendentals such as the matrix logarithm. Some
26+
functions that exist in both have augmented functionality in `scipy.linalg`.
27+
For example, `scipy.linalg.eig` can take a second matrix argument for solving
28+
generalized eigenvalue problems. Some functions in NumPy, however, have more
29+
flexible broadcasting options. For example, `numpy.linalg.solve` can handle
30+
"stacked" arrays, while `scipy.linalg.solve` accepts only a single square
31+
array as its first argument.
32+
2133
.. currentmodule:: numpy
2234

2335
Matrix and vector products

numpy/linalg/linalg.py

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ def solve(a, b):
345345
LinAlgError
346346
If `a` is singular or not square.
347347
348+
See Also
349+
--------
350+
scipy.linalg.solve : Similar function in SciPy.
351+
348352
Notes
349353
-----
350354
@@ -502,6 +506,10 @@ def inv(a):
502506
LinAlgError
503507
If `a` is not square or inversion fails.
504508
509+
See Also
510+
--------
511+
scipy.linalg.inv : Similar function in SciPy.
512+
505513
Notes
506514
-----
507515
@@ -700,6 +708,14 @@ def cholesky(a):
700708
If the decomposition fails, for example, if `a` is not
701709
positive-definite.
702710
711+
See Also
712+
--------
713+
scipy.linalg.cholesky : Similar function in SciPy.
714+
scipy.linalg.cholesky_banded : Cholesky decompose a banded Hermitian
715+
positive-definite matrix.
716+
scipy.linalg.cho_factor : Cholesky decomposition of a matrix, to use in
717+
`scipy.linalg.cho_solve`.
718+
703719
Notes
704720
-----
705721
@@ -812,6 +828,11 @@ def qr(a, mode='reduced'):
812828
LinAlgError
813829
If factoring fails.
814830
831+
See Also
832+
--------
833+
scipy.linalg.qr : Similar function in SciPy.
834+
scipy.linalg.rq : Compute RQ decomposition of a matrix.
835+
815836
Notes
816837
-----
817838
This is an interface to the LAPACK routines ``dgeqrf``, ``zgeqrf``,
@@ -1004,6 +1025,7 @@ def eigvals(a):
10041025
(conjugate symmetric) arrays.
10051026
eigh : eigenvalues and eigenvectors of real symmetric or complex
10061027
Hermitian (conjugate symmetric) arrays.
1028+
scipy.linalg.eigvals : Similar function in SciPy.
10071029
10081030
Notes
10091031
-----
@@ -1105,6 +1127,7 @@ def eigvalsh(a, UPLO='L'):
11051127
eigvals : eigenvalues of general real or complex arrays.
11061128
eig : eigenvalues and right eigenvectors of general real or complex
11071129
arrays.
1130+
scipy.linalg.eigvalsh : Similar function in SciPy.
11081131
11091132
Notes
11101133
-----
@@ -1203,12 +1226,12 @@ def eig(a):
12031226
See Also
12041227
--------
12051228
eigvals : eigenvalues of a non-symmetric array.
1206-
12071229
eigh : eigenvalues and eigenvectors of a real symmetric or complex
12081230
Hermitian (conjugate symmetric) array.
1209-
12101231
eigvalsh : eigenvalues of a real symmetric or complex Hermitian
12111232
(conjugate symmetric) array.
1233+
scipy.linalg.eig : Similar function in SciPy (but also solves the
1234+
generalized eigenvalue problem).
12121235
12131236
Notes
12141237
-----
@@ -1355,6 +1378,8 @@ def eigh(a, UPLO='L'):
13551378
(conjugate symmetric) arrays.
13561379
eig : eigenvalues and right eigenvectors for non-symmetric arrays.
13571380
eigvals : eigenvalues of non-symmetric arrays.
1381+
scipy.linalg.eigh : Similar function in SciPy (but also solves the
1382+
generalized eigenvalue problem).
13581383
13591384
Notes
13601385
-----
@@ -1506,6 +1531,11 @@ def svd(a, full_matrices=True, compute_uv=True, hermitian=False):
15061531
LinAlgError
15071532
If SVD computation does not converge.
15081533
1534+
See Also
1535+
--------
1536+
scipy.linalg.svd : Similar function in SciPy.
1537+
scipy.linalg.svdvals : Compute singular values of a matrix.
1538+
15091539
Notes
15101540
-----
15111541
@@ -1917,6 +1947,13 @@ def pinv(a, rcond=1e-15, hermitian=False):
19171947
LinAlgError
19181948
If the SVD computation does not converge.
19191949
1950+
See Also
1951+
--------
1952+
scipy.linalg.pinv : Similar function in SciPy.
1953+
scipy.linalg.pinv2 : Similar function in SciPy (SVD-based).
1954+
scipy.linalg.pinvh : Compute the (Moore-Penrose) pseudo-inverse of a
1955+
Hermitian matrix.
1956+
19201957
Notes
19211958
-----
19221959
The pseudo-inverse of a matrix A, denoted :math:`A^+`, is
@@ -2079,6 +2116,7 @@ def det(a):
20792116
--------
20802117
slogdet : Another way to represent the determinant, more suitable
20812118
for large matrices where underflow/overflow may occur.
2119+
scipy.linalg.det : Similar function in SciPy.
20822120
20832121
Notes
20842122
-----
@@ -2179,6 +2217,10 @@ def lstsq(a, b, rcond="warn"):
21792217
LinAlgError
21802218
If computation does not converge.
21812219
2220+
See Also
2221+
--------
2222+
scipy.linalg.lstsq : Similar function in SciPy.
2223+
21822224
Notes
21832225
-----
21842226
If `b` is a matrix, then all array results are returned as matrices.
@@ -2353,6 +2395,10 @@ def norm(x, ord=None, axis=None, keepdims=False):
23532395
n : float or ndarray
23542396
Norm of the matrix or vector(s).
23552397
2398+
See Also
2399+
--------
2400+
scipy.linalg.norm : Similar function in SciPy.
2401+
23562402
Notes
23572403
-----
23582404
For values of ``ord < 1``, the result is, strictly speaking, not a

0 commit comments

Comments
 (0)