Merge pull request #155 from Jeff1999/master

alternative solution for Q.82
This commit is contained in:
Nicolas P. Rougier 2021-07-27 07:48:55 +02:00 committed by GitHub
commit 3597f1191c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1148,7 +1148,7 @@ print(R)
Compute a matrix rank (★★★)
< h82
hint: np.linalg.svd
hint: np.linalg.svd, np.linalg.matrix_rank
< a82
# Author: Stefan van der Walt
@ -1158,6 +1158,12 @@ U, S, V = np.linalg.svd(Z) # Singular Value Decomposition
rank = np.sum(S > 1e-10)
print(rank)
# alternative solution:
# Author: Jeff Luo (@Jeff1999)
rank = np.linalg.matrix_rank(Z)
print(rank)
< q83
How to find the most frequent value in an array?