Hello, everyone.
I have a question for your help.
In matlab, the function norm could deal with matrix or vector, and it will deal with the input variable differently according to its type- for norm(A), it will return the largest singular value of A if A is a matrix, while return sum(abs(A).^2)^(1/2) if A is a vector. However, I found that for a vector A, the running time of norm(A) is shorter than sum(abs(A).^2)^(1/2), so I prefer using norm(A) to calculate the norm of a vector.
Now I have m vectors storing in a matrix A, each row of which is a vector, and I want to calculate their norms respectively. Maybe it is convenient to calculate them by
sum(A.^2,2)^(1/2), but as what I said before, using the function 'norm' could spend less calculation time. How ever, directly using norm(A) will retun the matrix norm of A instead of the norms of each vectors. How could I make the function 'norm' treat its input A as a sequence of vectors rather than a matrix?
Thank you!