Re: [eigen] create a class that use Eigen

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


Except for the Eigen:: namespace lacking before declaring mat in the
main. I see nothing wrong here.
Actually it compiles (minus this namespace thing) and exectues fines
on my computer ubuntu Maverick + gcc 4.4.5 + x86 with Eigen 3
downloaded the 2011/03/23.
For the developpers here, the Eigen version, the compiler, its version
and the system you are using may be of interest to help you and to be
able to reproduce the problem.

- best regards,
Manuel

On Thu, Jul 7, 2011 at 4:55 PM, Paolo PASTERIS <paolo.pasteris@xxxxxx> wrote:
> Hallo,
>
> i wont to create a class that take in input two matrix and a bool:
>
> #ifndef FOO_H_
> #define FOO_H_
>
> #include "Eigen/Core"
>
> template<class T>
> class Foo{
> private:
> protected:
> Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>* p0;
> Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>* p1;
> bool flag;
>
> public:
>
> Foo(Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>*
> p0,Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>* p1,bool flag){
> this->p0=p0;
> this->p1=p0;
> this->flag=flag;
> };
>
>
> };
>
> #endif
>
>
>
> int main(){
> Matrix<double,Eigen::Dynamic,Eigen::Dynamic> mat(3,5);
>
> mat << -0.0646, 0.4789, 0.2792, -0.1968, 0.3125,
> -0.1694, 0.2017, -0.0151, -0.2112, 0.1629,
> 1.0000, 1.0000, 1.0000, 1.0000, 1.0000;
>
> Foo<double> f(&mat,&mat,false);
> return 0;
> }
>
> The error is:
>
> src/main.cpp: In function ‘int main()’:
> src/main.cpp:33: error: no matching function for call to
> ‘Foo<double>::Foo(Eigen::Matrix<double, -0x00000000000000001,
> -0x00000000000000001, 0, -0x00000000000000001, -0x00000000000000001>&,
> Eigen::Matrix<double, -0x00000000000000001, -0x00000000000000001, 0,
> -0x00000000000000001, -0x00000000000000001>&, bool)’
> inc/arlab_math/geometry/foo.h:16: note: candidates are:
> Foo<T>::Foo(Eigen::Matrix<LhsScalar, -0x00000000000000001,
> -0x00000000000000001, 0, -0x00000000000000001, -0x00000000000000001>*,
> Eigen::Matrix<LhsScalar, -0x00000000000000001, -0x00000000000000001, 0,
> -0x00000000000000001, -0x00000000000000001>*, bool) [with T = double]
> inc/arlab_math/geometry/foo.h:7: note: Foo<double>::Foo(const Foo<double>&)
> make: *** [i686/debug/objs/main.o] Error 1
>
> Thanks for the help Paolo
>
>



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