Operations on a List of Vectors (Norm)

I have a List containing vectors. The coordinates are random numbers:

r = {RandomReal[{-1, 1}, n], RandomReal[{-1, 1}, n], RandomReal[{-1, 1}, n]};


Now I want to calculate the Norm of each Vector (into another List). Is this possible without a loop? Something like

Norm[r,2]


Where 2 is the dimension (columns) in which the norm should be calculated.

-
Your question is unclear: what is n? Is each vector of length (dimension) n or of length (dimension) 3? –  murray Nov 13 '12 at 16:04
Norm /@ Transpose[r] would do it, no? –  Ｊ. Ｍ. Nov 13 '12 at 16:08
n is the amount of vectors - sorry (in my example 1000) –  Vincent Nov 13 '12 at 16:12
And thanks J.M. your answer works like a charm (I searched something similar to "arrayfun" in Matlab). If you want you can post it as answer and I'll ccheck it as accepted answer –  Vincent Nov 13 '12 at 16:13

One way is to Map[ ] the Norm function onto the list of vectors:

 Map[Norm, r]


If you think of r as being a matrix (with 3 rows and n columns, per the OPs code), this gives you a list, where each entry is the norm of the corresponding row in r. You can also use the infix notation for Map[ ] which is /@

Norm /@ r


If you want the Norm applied to the columns, then a Transpose[ ] is needed

 Norm/@ Transpose[r]

-
OP's vectors are columns of the array and not the rows, so a preliminary Transpose[] is needed... –  Ｊ. Ｍ. Nov 13 '12 at 16:17
I had interpreted n as the length of each of the vectors (i.e., as the rows of the matrix r) with the goal of finding the norm of the three rows. If n is the number of vectors, and you want the norm of each column, then indeed you need to do Norm/@ Transpose[r] –  bill s Nov 13 '12 at 16:21