[Numpy-discussion] linalg.norm along axis?
Nicolas Pinto
pinto@mit....
Wed Feb 18 22:12:09 CST 2009
Grissiom,
Using the following doesn't require any loop:
In [9]: sqrt((a**2.).sum(1))
Out[9]: array([ 5., 10.])
Best,
On Wed, Feb 18, 2009 at 10:23 PM, Grissiom <chaos.proton@gmail.com> wrote:
> Hi all,
>
> Is there any possibility to calculate norm along axis? For example:
>
> a = np.array((
> (3,4),
> (6,8)))
>
> And I want to get:
> array([5.0, 10.0])
>
> I currently use a for loop to achieve this, Is there any more elegant way
> to do this?
>
> --
> Cheers,
> Grissiom
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
--
Nicolas Pinto
Ph.D. Candidate, Brain & Computer Sciences
Massachusetts Institute of Technology, USA
http://web.mit.edu/pinto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090218/72a21ebb/attachment.html
More information about the Numpy-discussion
mailing list