Re: [eigen] Overloading componentwise binary operators for vectors

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




On 05.10.2015 16:00, Cedric Doucet wrote:
Actually, it is very simple to get the best of both worlds if I understand how to overload operator + so that it returns Eigen::CwiseBinaryOp.
I just have to add a level of indirection by replacing Eigen::CwiseBinaryOp by a typedef coming from a template:

template<typename Wrapped>
class Vector;

template<typename Wrapped>
typename Wrapped::Sum operator+(Vector const & lhs, Vector const & rhs);


So, my question is very simple : what am I doing wrong in the code I sent to you?


As Gael already said, your Vector class also needs to have a constructor which accepts a DenseBase<Derived> (or a Wrapped::Sum, if you prefer).

Btw, to me it is still not obvious what you actually want to achieve here ...


Christoph

--
 Dipl. Inf., Dipl. Math. Christoph Hertzberg

 Universität Bremen
 FB 3 - Mathematik und Informatik
 AG Robotik
 Robert-Hooke-Straße 1
 28359 Bremen, Germany

 Zentrale: +49 421 178 45-6611

 Besuchsadresse der Nebengeschäftstelle:
 Robert-Hooke-Straße 5
 28359 Bremen, Germany

 Tel.:    +49 421 178 45-4021
 Empfang: +49 421 178 45-6600
 Fax:     +49 421 178 45-4150
 E-Mail:  chtz@xxxxxxxxxxxxxxxxxxxxxxxx

 Weitere Informationen: http://www.informatik.uni-bremen.de/robotik



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