[Numpy-discussion] norm in scipy.linalg but not numpy?

dmitrey openopt at ukr.net
Wed May 23 11:56:28 EDT 2007


hi all,
I was very surprised that norm() is present in scipy.linalg but absent 
in numpy.
Don't you think it's better to add the one to numpy?
As for me, I use the func very intensively, and I don't want to write my 
own (slow) func in Python or use

sqrt(dot(v,v))
or
scipy.linalg.norm(v) (i.e. make dependence on scipy because of single 
function linalg.norm())
(as it is proposed in http://www.scipy.org/NumPy_for_Matlab_Users)

and what about second argument to norm, as MATLAB provides?
norm(x) = norm(x,2) by default, norm(x, inf) = max(abs(x)), norm(x, 
-inf) = min(abs(x)), norm(x,1) = sum(abs(x)), norm(x,p) = 
(x1^p+...)^(1/p) etc...
Of course, I could write those 10-15 lines of code in Python, but I 
think C or Pyrex would be better and faster.
D.



More information about the NumPy-Discussion mailing list