Voice et bot modif

This commit is contained in:
pi 2026-06-16 17:09:34 +00:00
parent 189d56026b
commit 7333a22bcd
10774 changed files with 634644 additions and 933308 deletions

View file

@ -61,7 +61,6 @@ from numpy._core import (
overrides,
prod,
reciprocal,
sign,
single,
sort,
sqrt,
@ -1810,7 +1809,8 @@ def svd(a, full_matrices=True, compute_uv=True, hermitian=False):
# and related arrays to have the correct order
if compute_uv:
s, u = eigh(a)
sgn = sign(s)
# avoid zero sign
sgn = np.copysign(1.0, s)
s = abs(s)
sidx = argsort(s)[..., ::-1]
sgn = np.take_along_axis(sgn, sidx, axis=-1)
@ -2130,6 +2130,7 @@ def matrix_rank(A, tol=None, hermitian=False, *, rtol=None):
A = asarray(A)
if A.ndim < 2:
return int(not all(A == 0))
S = svd(A, compute_uv=False, hermitian=hermitian)
if tol is None:
@ -2137,7 +2138,7 @@ def matrix_rank(A, tol=None, hermitian=False, *, rtol=None):
rtol = max(A.shape[-2:]) * finfo(S.dtype).eps
else:
rtol = asarray(rtol)[..., newaxis]
tol = S.max(axis=-1, keepdims=True) * rtol
tol = S.max(axis=-1, keepdims=True, initial=0) * rtol
else:
tol = asarray(tol)[..., newaxis]