summaryrefslogtreecommitdiff
path: root/numpy/linalg/linalg.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #22786 from asmeurer/linalg-namedtuplesHEADmainCharles Harris2023-05-171-108/+149
|\ | | | | ENH: Add namedtuple return types to linalg functions that return tuples
| * TYP: Update type annotations for the new linalg named tuplesBas van Beek2023-05-171-11/+11
| |
| * MAINT: Update numpy/linalg/linalg.pyCharles Harris2023-05-171-1/+1
| | | | | | Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
| * Fix a doctestAaron Meurer2022-12-131-1/+1
| |
| * Add namedtuple return types to linalg functions that return tuplesAaron Meurer2022-12-121-107/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That is, eig(), eigh(), qr(), slogdet(), and svd(). For those functions that return non-tuples with certain keyword arguments, the return type is unchanged. This change should be completely backwards compatible. The namedtuple attribute names come from the array API specification (see, e.g., https://data-apis.org/array-api/latest/extensions/generated/signatures.linalg.eigh.html), with the exception of eig() which is just the same as eigh(). The name of the namedtuple object itself is not part of the specification or the public API. I have not used a namedtuple for the tuple output for qr(mode='raw'), which returns (h, tau). This updates the docstrings to use the updated namedtuple return names, and also the examples to use those names more consistently. This also updates the tests to check each function for the namedtuple attributes at least once.
* | DEP: deprecate `product`, `cumproduct`, `sometrue`, `alltrue`Ralf Gommers2023-03-021-2/+2
| | | | | | | | [skip cirrus]
* | ENH: Improve performance of finfo and _commonType (#23088)Pieter Eendebak2023-02-151-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | The finfo contains a cache for dtypes, but the np.complex128 dtype does not end up in the cache. The reason is that the np.complex128 is converted to np.float64 which is in the cache. Performance improvement for finfo(np.complex128): Main: 2.07 µs ± 75 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each) Pr: 324 ns ± 28.9 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each) Improve performance of finfo by making the cache check the first action in the __new__ Improve performance of _commonType by re-using the expression for a.dtype.type and eliminating variables The finfo and _commonType was part of the computatation time in lstsq when using scikit-rf. Since these methods are used in various other methods performance can improve there slightly as well.
* | Merge pull request #21888 from WillTirone/fix_scipy_1339Matti Picus2023-01-251-2/+2
|\ \ | | | | | | MAINT: changing the method of checking for nan / inf values linalg.eig
| * | ENH: unifying error type for gh scipy #1339Will Tirone2023-01-241-5/+9
| | |
| * | MAINT: changing the method of checking for nan / inf values in numpy.linalg.eig.Will Tirone2022-06-291-7/+3
| | | | | | | | | | | | Changing numpy to use the same function from numpy.lib.function_base as scipy. Tests pass.
* | | MAINT: Fix stacklevels for the new C dispatcher not adding oneSebastian Berg2023-01-171-3/+3
| |/ |/|
* | MAINT: Move set_module to numpy.core to use without C importSebastian Berg2022-11-241-2/+2
| |
* | Merge pull request #22313 from rossbar/deprecate-fastCopyAndTransposeMatti Picus2022-10-071-16/+2
|\ \ | | | | | | DEP: Deprecate fastCopyAndTranspose
| * | MAINT: rm private, unused linalg function.Ross Barnowski2022-10-061-11/+0
| | |
| * | DEP: fastCopyAndTranspose and PyArray_CopyAndTransposeRoss Barnowski2022-10-061-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | Deprecate the fastCopyAndTranspose function from the Python API, and the underlying PyArray_CopyAndTranspose function from the C-API. Also removes an internal, private function _fastCopyAndTranspose which was the original Python wrapper around the C-function.
* | | Fix linalg.tensorsolve docstringYin Li2022-08-181-1/+1
|/ /
* | remove redundant reversal of eigenvalues orderKIU Shueng Chuan2022-08-121-1/+0
|/
* DOC:linalg: Remove ref to scipy.linalg.pinv2Ilhan Polat2022-05-221-1/+0
|
* PERF: Reduce overhead of np.linalg.norm for small arrays (#21394)Pieter Eendebak2022-05-031-2/+4
| | | | Reduce the overhead of np.linalg.norm by replacing dot(x,x) with x.dot(x). This is OK, since `x` is converted to a base-class array here.
* BUG: Consistent promotion for norm for all values of ord (#17709)Toshiki Kataoka2022-04-071-2/+3
| | | | | | | | | Previously, numpy.linalg.norm would return values with the same floating-point type as input arrays for most values of the ``ord`` parameter, but not all. This PR fixes this so that the output dtype matches the input for all (valid) values of ``ord``. Co-authored-by: Kenichi Maehashi <webmaster@kenichimaehashi.com> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* DOC: Update linalg.qr docstring with numerically stable example (#21149)Jason Thai2022-03-071-2/+2
| | | Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
* Update numpy/linalg/linalg.pyDiego Wang2022-02-251-5/+6
| | | Co-authored-by: Charles Harris <charlesr.harris@gmail.com>
* clarify svd documentationDiego Wang2022-02-241-2/+3
| | | `u @ np.diag(s) @ vh` can only reproduce the original matrix when `full_matrices` is `False`, otherwise dimension does not match.
* DOC: clarify the return value of linalg.choleskyStephan Hoyer2022-02-171-2/+2
| | | | | It is in fact always lower-triangular. The errorenous note might date to when function was forked from SciPy?
* BUG: Fix tensorsolve for 0-sized inputIvan Yashchuk2021-11-291-1/+7
| | | | | | | | `array.reshape(-1, size)` doesn't work with 0 in the dimensions. The fix is to use explicit shape instead of `-1`. For "non-square" tensors the `ValueError` would come from the reshape call, while previously `LinAlgError` appeared from the solve call. To have the same error type I added a check for squareness before the reshape.
* Merge pull request #20156 from melissawm/fix-cond-docsCharles Harris2021-10-251-2/+2
|\ | | | | DOC: Fixed docstring for parameters 2 and -2 on linalg.cond
| * DOC: Clarify table contents in cond docstringmelissawm2021-10-221-4/+4
| |
| * DOC: Fixed docstring for parameters 2 and -2 on linalg.condmelissawm2021-10-211-2/+2
| |
* | MAINT: remove unused importsAlessia Marcolini2021-10-081-1/+1
|/
* DOC: Typos found by codespellDimitri Papadopoulos2021-09-211-2/+2
|
* Merge pull request #19151 from czgdp1807/stack_matMatti Picus2021-07-141-66/+58
|\ | | | | ENH: Vectorising np.linalg.qr
| * removed redudancy in codeczgdp18072021-07-101-18/+8
| |
| * Addressed testing reviewsczgdp18072021-06-241-2/+2
| |
| * Addressed reviewsczgdp18072021-06-081-3/+7
| |
| * documentation fixczgdp18072021-06-051-2/+2
| |
| * resolved linting issuesczgdp18072021-06-051-1/+1
| |
| * resolved linting issuesczgdp18072021-06-051-1/+2
| |
| * removed trailing white spacesczgdp18072021-06-051-4/+4
| |
| * linting issue fixedczgdp18072021-06-051-1/+2
| |
| * documentation updatedczgdp18072021-06-051-8/+20
| |
| * existing tests passedczgdp18072021-06-051-3/+16
| |
| * ready for formal addition of tests and documentation updateczgdp18072021-06-041-44/+12
| |
| * WIPczgdp18072021-06-041-42/+58
| |
| * ENH: r, raw, economic now accept stacked matricesczgdp18072021-06-031-22/+9
| |
* | Merge pull request #19102 from default-303/LGTM_unused_variablesMatti Picus2021-07-091-6/+0
|\ \ | | | | | | MAINT: Removed suitable unused variables shown in LGTM
| * | MAINT: Removed 'if' block which served no purpose in core.py and removed ↵default-3032021-05-261-4/+0
| | | | | | | | | | | | '_linalgRealType(t)' function from linalg.py
| * | MAINT: Removed suitable unused variables shown in LGTMdefault-3032021-05-261-2/+0
| |/
* | Merge branch 'main' into matrix_rank-doc-fixAaron Meurer2021-06-141-2/+3
|\ \ | |/
| * STY: Add spaces around '-'.Charles Harris2020-12-301-1/+1
| | | | | | [ci skip]
| * DOC: add missing details to linalg.lstsq docstringNilo Kruchelski2020-12-301-2/+3
| | | | | | | | | | | | | | It turns out that lstsq also minimizes the 2-norm of x when a is rank-deficient. I found that by searching the documentation for the LAPACK library, which is the current implementation of lstsq (as of Dec 2020). Ref: https://www.netlib.org/lapack/lug/node27.html