Merge pull request #155 from Jeff1999/master

alternative solution for Q.82
This commit is contained in:
Nicolas P. Rougier authored and GitHub committed 2021-07-27 07:48:55 +02:00
commit 3597f1191c
1 file changed
+7 -1
+7 -1
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?