dmitrey wrote:
> 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?
In [237]: import numpy
In [238]: numpy.linalg.norm?
Type: function
Base Class: <type 'function'>
Namespace: Interactive
File:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.0.3.dev3795-py2.5-macosx-10.3-fat.egg/numpy/linalg/linalg.py
Definition: numpy.linalg.norm(x, ord=None)
Docstring:
norm(x, ord=None) -> n
Matrix or vector norm.
Inputs:
x -- a rank-1 (vector) or rank-2 (matrix) array
ord -- the order of the norm.
Comments:
For arrays of any rank, if ord is None:
calculate the square norm (Euclidean norm for vectors,
Frobenius norm for matrices)
For vectors ord can be any real number including Inf or -Inf.
ord = Inf, computes the maximum of the magnitudes
ord = -Inf, computes minimum of the magnitudes
ord is finite, computes sum(abs(x)**ord,axis=0)**(1.0/ord)
For matrices ord can only be one of the following values:
ord = 2 computes the largest singular value
ord = -2 computes the smallest singular value
ord = 1 computes the largest column sum of absolute values
ord = -1 computes the smallest column sum of absolute values
ord = Inf computes the largest row sum of absolute values
ord = -Inf computes the smallest row sum of absolute values
ord = 'fro' computes the frobenius norm sqrt(sum(diag(X.H * X),axis=0))
For values ord < 0, the result is, strictly speaking, not a
mathematical 'norm', but it may still be useful for numerical purposes.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion