From 731d5755696dbbd7c2f1cbf47c3564e9a0f2f029 Mon Sep 17 00:00:00 2001 From: Jeff1999 Date: Tue, 27 Jul 2021 10:11:29 +0800 Subject: [PATCH] alternative solution for Q.82 --- source/exercises100.ktx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/exercises100.ktx b/source/exercises100.ktx index cba706d..d1e1700 100644 --- a/source/exercises100.ktx +++ b/source/exercises100.ktx @@ -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?