[eigen] Re: problem with local nested typedefs

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


Hi,

I am trying to access the triangularView method of an Eigen3 matrix using the following code:

template< class Derived >
void get_view_local_td( MatrixBase<Derived>& in )
{
    typedef typename MatrixBase<Derived>::Scalar        Float;
    typedef Matrix<Float, Dynamic, Dynamic>         MatrixType;

    MatrixType& ref = static_cast<MatrixType&>( in );
    ref.triangularView<StrictlyUpper>();
}

This results in the error:

In function ‘void get_view_local_td(Eigen::MatrixBase<Derived>&)’:
/home/psauer/software/sources/cpp/sandbox/eigen/eigen_sandbox.cxx:95: error: expected primary-_expression_ before ‘)’ token
/home/psauer/software/sources/cpp/sandbox/eigen/eigen_sandbox.cxx: In function ‘void get_view_local_td(Eigen::MatrixBase<Derived>&) [with Derived = Eigen::Matrix<double, -0x00000000000000001, -0x00000000000000001, 0, -0x00000000000000001, -0x00000000000000001>]’:
/home/psauer/software/sources/cpp/sandbox/eigen/eigen_sandbox.cxx:115:   instantiated from here
/home/psauer/software/sources/cpp/sandbox/eigen/eigen_sandbox.cxx:95: error: no match for ‘operator<’ in ‘ref->Eigen::MatrixBase::triangularView [with unsigned int Mode = Mode, Derived = Eigen::Matrix<double, -0x00000000000000001, -0x00000000000000001, 0, -0x00000000000000001, -0x00000000000000001>] < (Eigen::._96)10u’

The problem appears to be the use of the nested typedef in MatrixType. If I replace the implicit Float type with e.g. double, the code compiles and runs.
Am I missing something, or is the use of nested typedefs illegal inside C++ functions?

Thanks.

Kind regards,

Patrick


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