I have an array of (say, row) vectors,

  v = [ [ a1, a2, a3 ],
        [ b1, b2, b3 ],
        [ c1, c2, c3 ],
        ...
      ]

What is the optimal way to compute the norm of each vector,
  norm(v)**2 = [
      [ a1**2 + a2**2 + a3**2 ],
      [ b1**2 + b2**2 + b3**2 ],
      ...
    ]

It seems clear that numpy.norm does not handle the multidimensional case
as needed. The best thing I can think of is to do something like,

  sum(v**2, axis=0) * ones(3)

but surely there must be a better way. Any ideas?

Cheers,

 - Ben
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to