NumSharp icon indicating copy to clipboard operation
NumSharp copied to clipboard

np.linalg.norm

Open henon opened this issue 5 years ago • 5 comments

I am going to port np.linalg.norm(...)

henon avatar Apr 05 '19 10:04 henon

It's not same as ? image

Oceania2018 avatar Apr 05 '19 15:04 Oceania2018

ok, you are right. that implements the L2 norm I need. I'll add the shortcut np.linalg.norm(...) just for Python compatibility

henon avatar Apr 05 '19 16:04 henon

no, after checking the code against the numpy docs, actually, the 2-norm is not the same what has been implemented in normalize(). There is no squaring of coefficients. Is that a bug?

https://het.as.utexas.edu/HET/Software/Numpy/reference/generated/numpy.linalg.norm.html

henon avatar Apr 05 '19 16:04 henon

Yes, they're different.

Oceania2018 avatar Apr 05 '19 18:04 Oceania2018

Hi,

I also noticed that the function is missing in 0.20.5. I think one could add a shortcut from np.linalg.norm(a) => np.sqrt(a.dot(a)) instead, which should be equivalent. Not sure about the overloads though.

Does this make sense to you?

Take care, Martin

8 avatar Oct 09 '20 07:10 8