Summary: | extend lpNorm with 0 and -infinity | ||
---|---|---|---|
Product: | Eigen | Reporter: | MartinS <martin.seemann> |
Component: | Core - general | Assignee: | Nobody <eigen.nobody> |
Status: | DECISIONNEEDED --- | ||
Severity: | Feature Request | CC: | chtz, gael.guennebaud, jacob.benoit.1, martin.seemann |
Priority: | Normal | Keywords: | JuniorJob |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
MartinS
2016-04-08 08:50:13 UTC
Fixed: https://bitbucket.org/eigen/eigen/commits/677c9f157781/ Regarding L_0, v.array().count() does not define a proper norm, and L_0 refers to another definition for mathematicians, i.e.: (v.abs()/(1+v.abs())).sum()/2^n Regarding minus infinity, are there any use cases? Using \ell_0 as "counting norm" is not completely uncommon: https://en.wikipedia.org/wiki/Lp_space#When_p_.3D_0 But, I guess using v.array().count() would definitely be less confusing here. The same goes for v.cwiseAbs().minCoeff() instead of lpNorm<NegativeInfinity>(); We could also consider providing a v.lpNorm(const RealScalar& p) function (allowing non-integer p), which for for p<1 returns the corresponding pseudo norm (however, for p-->0 the natural limit for anything with more than one non-zero would be infinity instead of .array().count() -- and for floating point values checking != 0.0 actually is often meaningless ...) yes, I perfectly agree that using L_0 as v.array().count() is extremely common! I just wanted to point out that there do exist a risk of ambiguity. Ok for v.lpNorm(const RealScalar& p). Thanks for the fix! Regarding the 0-case: After checking the Wikipedia article, I also agree that v.array().count() is less ambiguous and should be preferred. The variant with a runtime norm type is a good idea, though. For performance reasons, I would also propose an integer overload that behaves exactly as the templated version for the special argument values 1, 2 and Eigen::Infinity. Regarding minus infinity: I had no particular use case in mind. It was just a consideration for bringing the API on par with Matlab/Octave. -- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1193. |