Re: [eigen] min(Arr1,Arr2) is it supposed to work? [again] |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Hi again,I think I've missed an ambiguity-issue with the enable_if overload - hence I fear it is indeed not possible without stepping through all the types...
Best regards, Karli On 04/04/2011 04:23 PM, Gael Guennebaud wrote:
oops, indeed the quick ref guide is again in advance with Eigen development. Actually, it seems to be impossible for us to support std::min(array1,array2) because std::min is implemented in a generic way as: template<typename _Tp> inline const _Tp& min(const _Tp& __a, const _Tp& __b) { if (__b< __a) return __b; return __a; } therefore we cannot overload std::min for min(const ArrayBase<T>&,const ArrayBase<T>&). To do so we would need overloads for every expressions (Array<>, CwiseUnaryOp, CwiseBinaryOp, etc.). I'm fixing the doc. gael On Fri, Apr 1, 2011 at 9:23 AM, Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx> wrote:Hi, is the following assumed to work (I saw it in the Quick Reference Guide) #include<Eigen/Core> #include<cmath> given Eigen::Array3f V1, V2, V3; V1<< 1,2,3; V2<< 2,1,5; V3= V1.min(V2); // this works V3= std::pow(V1,2); // this works, as well V3= std::min(V1,V2); // but this fails, see below cout<< V3<< endl; } Tmin.C:14:21: instantiated from here /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4/bits/ stl_algobase.h:191:7: error: could not convert '((const Eigen::ArrayBase<Eigen::Array<float, 3, 1> >*)((const Eigen::Array<float, 3, 1>*)__b))->Eigen::ArrayBase<Derived>::operator< [with OtherDerived = Eigen::Array<float, 3, 1>, Derived = Eigen::Array<float, 3, 1>, typename Eigen::internal::traits<T>::Scalar = float](((const Eigen::ArrayBase<Eigen::Array<float, 3, 1> >&)((const Eigen::ArrayBase<Eigen::Array<float, 3, 1> >*)((const Eigen::Array<float, 3, 1>*)__a))))' to 'bool' Thanks for some info, Helmut.
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |