This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen with non POD types

Tags: None
(comma "," separated)
senseiwa
Registered Member
Posts
3
Karma
0

Eigen with non POD types

Thu Aug 06, 2015 4:22 pm
Dear all,

I am trying to use Eigen with custom classes, but it seems that in many parts there are non-traits calls. Consider this code:

Code: Select all
typedef boost::numeric::interval<double,
                            boost::numeric::interval_lib::policies<
                                boost::numeric::interval_lib::save_state<
                                    boost::numeric::interval_lib::rounded_transc_std<double>
                                >,
                                boost::numeric::interval_lib::checking_base<double>
                            >
                        > scalar;
typedef Eigen::SparseMatrix<scalar, Eigen::RowMajor> iMatrix;
typedef Eigen::Matrix<scalar, Eigen::Dynamic, 1>     iVector;

// ...
    Eigen::SparseLU<iMatrix> lu;
   
    t.start("init lu");
    lu.analyzePattern(m);
    t.stop();

    t.start("factorize lu");
    lu.factorize(m);
    t.stop();

    // p = m * v --> m q = p --> q == v
    t.start("solve");
    q = lu.solve(p);
    t.stop();


It cannot compile since the pivot call uses a direct std::abs call:
Code: Select all
template <typename Scalar, typename Index>
Index SparseLUImpl<Scalar,Index>::pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu)
{
  // ...
  for (isub = nsupc; isub < nsupr; ++isub) {
    rtemp = std::abs(lu_col_ptr[isub]); // <------- HERE
    if (rtemp > pivmax) {


Here's the error:
Code: Select all
/usr/local/include/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h:80:13: No matching function for call to 'abs'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/stdlib.h:129:6: Candidate function not viable: no known conversion from 'boost::numeric::interval<double, boost::numeric::interval_lib::policies<boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_transc_std<double, boost::numeric::interval_lib::rounded_arith_std<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_base<double> > >' to 'int' for 1st argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:159:44: Candidate function not viable: no known conversion from 'boost::numeric::interval<double, boost::numeric::interval_lib::policies<boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_transc_std<double, boost::numeric::interval_lib::rounded_arith_std<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_base<double> > >' to 'long' for 1st argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:161:44: Candidate function not viable: no known conversion from 'boost::numeric::interval<double, boost::numeric::interval_lib::policies<boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_transc_std<double, boost::numeric::interval_lib::rounded_arith_std<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_base<double> > >' to 'long long' for 1st argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:660:1: Candidate function not viable: no known conversion from 'boost::numeric::interval<double, boost::numeric::interval_lib::policies<boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_transc_std<double, boost::numeric::interval_lib::rounded_arith_std<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_base<double> > >' to 'float' for 1st argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:664:1: Candidate function not viable: no known conversion from 'boost::numeric::interval<double, boost::numeric::interval_lib::policies<boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_transc_std<double, boost::numeric::interval_lib::rounded_arith_std<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_base<double> > >' to 'double' for 1st argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:668:1: Candidate function not viable: no known conversion from 'boost::numeric::interval<double, boost::numeric::interval_lib::policies<boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_transc_std<double, boost::numeric::interval_lib::rounded_arith_std<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_base<double> > >' to 'long double' for 1st argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:883:1: Candidate template ignored: could not match 'complex' against 'interval'


Am I missing something?

Thanks for any hints!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Eigen with non POD types

Sun Aug 09, 2015 8:17 pm
Looks like you are using a old version: https://bitbucket.org/eigen/eigen/src/b ... ivotL.h-60


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]