[eigen] eigen sqrt compilation error

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


Hi,

I am surprised at this code. The line containing the sqrt is
generating lot's of errors. Its the only place in the code (it is line
61) where I am getting errors.

 VectorXf mu[framesAfterCDS],sigma[framesAfterCDS];
//framesAfterCDS is a compile time constant
    for(i=0; i<framesAfterCDS; i++)
	{
	mu[i]=x_accum[i]*(1.0/N);
	sigma[i]=(x2_accum[i]*(1.0/N)-mu[i].cwise()*mu[i]);
	sigma[i]=sigma[i].cwise().sqrt();
	}

==========
error msg begin
==========

g++ -Wall -I. analysis.cpp binary_matrix_io.c -O2 -msse3 -march=native
-mtune=native -o analysis -I/home/rpg/Documents/numerical/eigen2

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/CwiseUnaryOp.h: In
instantiation of ‘Eigen::CwiseUnaryOp<Eigen::ei_scalar_sqrt_op<float>,
Eigen::Matrix<float, 10000, 1, 2, 10000, 1> >’:
analysis.cpp:61:   instantiated from here

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/CwiseUnaryOp.h:97:
error: ‘Eigen::CwiseUnaryOp<UnaryOp, MatrixType>::m_functor’ has
incomplete type

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/util/ForwardDeclarations.h:71:
error: declaration of ‘const struct Eigen::ei_scalar_sqrt_op<float>’

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/CwiseUnaryOp.h: In
member function ‘const typename
Eigen::ei_traits<Eigen::CwiseUnaryOp<UnaryOp, MatrixType>

>::Scalar Eigen::CwiseUnaryOp<UnaryOp, MatrixType>::coeff(int, int) const [with UnaryOp = Eigen::ei_scalar_sqrt_op<float>, MatrixType = Eigen::Matrix<float, 10000, 1, 2, 10000, 1>]’:

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/Coeffs.h:331:
instantiated from ‘void Eigen::MatrixBase<Derived>::copyCoeff(int,
int, const Eigen::MatrixBase<OtherDerived>&) [with OtherDerived =
Eigen::CwiseUnaryOp<Eigen::ei_scalar_sqrt_op<float>,
Eigen::Matrix<float, 10000, 1, 2, 10000, 1> >, Derived =
Eigen::Matrix<float, 10000, 1, 2, 10000, 1>]’

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/Assign.h:221:
instantiated from ‘static void Eigen::ei_assign_impl<Derived1,
Derived2, 3, 0>::run(Derived1&, const Derived2&) [with Derived1 =
Eigen::Matrix<float, 10000, 1, 2, 10000, 1>, Derived2 =
Eigen::CwiseUnaryOp<Eigen::ei_scalar_sqrt_op<float>,
Eigen::Matrix<float, 10000, 1, 2, 10000, 1> >]’

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/Assign.h:407:
instantiated from ‘Derived&
Eigen::MatrixBase<Derived>::lazyAssign(const
Eigen::MatrixBase<OtherDerived>&) [with OtherDerived =
Eigen::CwiseUnaryOp<Eigen::ei_scalar_sqrt_op<float>,
Eigen::Matrix<float, 10000, 1, 2, 10000, 1> >, Derived =
Eigen::Matrix<float, 10000, 1, 2, 10000, 1>]’

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/Assign.h:422:
instantiated from ‘static Derived& Eigen::ei_assign_selector<Derived,
OtherDerived, false, false>::run(Derived&, const OtherDerived&) [with
Derived = Eigen::Matrix<float, 10000, 1, 2, 10000, 1>, OtherDerived =
Eigen::CwiseUnaryOp<Eigen::ei_scalar_sqrt_op<float>,
Eigen::Matrix<float, 10000, 1, 2, 10000, 1> >]’

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/Assign.h:442:
instantiated from ‘Derived&
Eigen::MatrixBase<Derived>::operator=(const
Eigen::MatrixBase<OtherDerived>&) [with OtherDerived =
Eigen::CwiseUnaryOp<Eigen::ei_scalar_sqrt_op<float>,
Eigen::Matrix<float, 10000, 1, 2, 10000, 1> >, Derived =
Eigen::Matrix<float, 10000, 1, 2, 10000, 1>]’

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/Matrix.h:511:
instantiated from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options,
_MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options,
_MaxRows, _MaxCols>::_set(const Eigen::MatrixBase<OtherDerived>&)
[with OtherDerived =
Eigen::CwiseUnaryOp<Eigen::ei_scalar_sqrt_op<float>,
Eigen::Matrix<float, 10000, 1, 2, 10000, 1> >, _Scalar = float, int
_Rows = 10000, int _Cols = 1, int _Options = 2, int _MaxRows = 10000,
int _MaxCols = 1]’

/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/Matrix.h:261:
instantiated from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options,
_MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options,
_MaxRows, _MaxCols>::operator=(const Eigen::MatrixBase<OtherDerived>&)
[with OtherDerived =
Eigen::CwiseUnaryOp<Eigen::ei_scalar_sqrt_op<float>,
Eigen::Matrix<float, 10000, 1, 2, 10000, 1> >, _Scalar = float, int
_Rows = 10000, int _Cols = 1, int _Options = 2, int _MaxRows = 10000,
int _MaxCols = 1]’

analysis.cpp:61:   instantiated from here
/home/rpg/Documents/numerical/eigen2/Eigen/src/Core/CwiseUnaryOp.h:75:
error: using invalid field ‘Eigen::CwiseUnaryOp<UnaryOp,
MatrixType>::m_functor’

The error is there with both the 2.0.2 and dev branch.

Can somebody help me?

-- 
Rohit Garg

http://rpg-314.blogspot.com/

Senior Undergraduate
Department of Physics
Indian Institute of Technology
Bombay



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