Re: [eigen] Does c++ use of "norm" bother anyone else?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Markus Moll wrote:
Hi

On Thursday 18 June 2009 14:15:01 Markus Moll wrote:
On Thursday 18 June 2009 13:40:34 Benoit Jacob wrote:
Then I think that it's safe to
implement std::norm also for Eigen::Complex, as it's documented there
what it does.
That's the same problem as with std::vector, no? Eigen::Complex will be a
template, so there's no way to specialize std::norm properly.

Oh, but I think that this issue was resolved by requiring that library functions (and, in fact, just about everyone else) use the unqualified names. This, together with argument dependent lookup, allows things like:

namespace std { template<typename T> T norm(const complex<T>& c); }
namespace Eigen { template<typename T> T norm(const Complex<T>& c); }
template<typename C> void g(const C& c) { norm(c); /* where c is either Eigen::Complex or std::complex */ }

to work correctly.

So in fact, Eigen should best implement a template<typename T> Eigen::norm(const Eigen::Complex<T>&)
function template with the std::complex semantics.

Markus
I agree that we should begrudgingly provide norm(Complex ).
I like Benoit's suggestion of also providing abs2(Complex)





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/