8000 MAINT: Fix the cutoff value inconsistency for pinv2 and pinvh by ilayn · Pull Request #10067 · scipy/scipy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Fix the cutoff value inconsistency for pinv2 and pinvh #10067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 25, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Split
Diff view
Prev Previous commit
Next Next commit
MAINT: Fix cond value of pinv
  • Loading branch information
ilayn committed Apr 16, 2019
commit e2e1776f29cc3a403b45d3a1e31b39c59b996fb9
11 changes: 6 additions & 5 deletions scipy/linalg/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,10 +1257,9 @@ def pinv(a, cond=None, rcond=None, return_rank=False, check_finite=True):
Matrix to be pseudo-inverted.
cond, rcond : float, optional
8000 Cutoff for 'small' singular values in the least-squares solver.
Singular values smaller than ``rcond * largest_singular_value``
are considered zero.
If None, it is set to ``np.finfo(a.dtype).eps``.
If `a` is an array of integers, it is set to ``np.finfo('float64').eps``.
Singular values smaller than ``max(M, N) * eps`` are considered zero
where ``eps`` is the corresponding machine precision value of the
datatype of ``a``.
return_rank : bool, optional
if True, return the effective rank of the matrix
check_finite : bool, optional
Expand Down Expand Up @@ -1293,7 +1292,9 @@ def pinv(a, cond=None, rcond=None, return_rank=False, check_finite=True):
"""
a = _asarray_validated(a, check_finite=check_finite)
b = np.identity(a.shape[0], dtype=a.dtype)
if rcond is not None:
if rcond is None:
cond = max(a.shape) * np.spacing(a.real.dtype.type(1))
else:
cond = rcond

x, resids, rank, s = lstsq(a, b, cond=cond, check_finite=False)
Expand Down
0