numpy-100
numpy-100 copied to clipboard
An alternative solution for Q.82
- Compute a matrix rank (★★★) hint: np.linalg.svd
# Author: Stefan van der Walt
Z = np.random.uniform(0,1,(10,10)) U, S, V = np.linalg.svd(Z) # Singular Value Decomposition rank = np.sum(S > 1e-10) print(rank)
numpy.linalg.matrix_rank
Doc provides an alternative way to compute matrix rank.
The alternative solution will be:
from numpy.linalg import matrix_rank
Z = np.random.uniform(0,1,(10,10))
print(matrix_rank(Z))
Not sure to see the link between the question and your answer.
Not sure to see the link between the question and your answer.
My bad. I've updated Q.82 in my last comment.
Should I close this issue then?