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

compilation error with SparseLU Eigen3.3

Tags: None
(comma "," separated)
fgeorget
Registered Member
Posts
7
Karma
0
I get a compilation error with Eigen3.3-beta1 (the release (version in debian testing) and the master branch of the repository) when using the SparseLU solver. It's seems to come from a type problem ( a reference is missing) but I don't know enough about Eigen internals to be sure.

This is how I use the solver : https://bitbucket.org/specmicp/specmicp ... ew-default

The compilation error is included below. What changes were made between 2.8 and 3.3 ? What changes do I need to make in my code ?
Code: Select all
In file included from /home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/SparseLU:44:0,
                 from /home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/Sparse:29,
                 from /home/manawy/princeton/progra/specmicp/src/dfpm/solver/parabolic_program.hpp:40,
                 from /home/manawy/princeton/progra/specmicp/src/dfpm/1dtransport/diffusion.hpp:46,
                 from /home/manawy/princeton/progra/specmicp/src/reactmicp/equilibrium_curve/eqcurve_coupler.hpp:41,
                 from /home/manawy/princeton/progra/specmicp/src/reactmicp/equilibrium_curve/eqcurve_coupler.cpp:35:
/home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/src/SparseLU/SparseLU.h: In instantiation of ‘void Eigen::SparseLU<_MatrixType, _OrderingType>::analyzePattern(const MatrixType&) [with _MatrixType = Eigen::SparseMatrix<double, 0, int>; _OrderingType = Eigen::COLAMDOrdering<long int>; Eigen::SparseLU<_MatrixType, _OrderingType>::MatrixType = Eigen::SparseMatrix<double, 0, int>]’:
/home/manawy/princeton/progra/specmicp/src/specmicp_common/sparse_solvers/sparse_lu.hpp:62:9:   required from ‘void specmicp::sparse_solvers::SparseSolverLU<MatrixT, DerivedR, DerivedS>::analyse_pattern(const MatrixT&) [with MatrixT = Eigen::SparseMatrix<double, 0, int>; DerivedR = Eigen::Matrix<double, -1, 1>; DerivedS = Eigen::Matrix<double, -1, 1>]’
/home/manawy/princeton/progra/specmicp/src/reactmicp/equilibrium_curve/eqcurve_coupler.cpp:111:1:   required from here
/home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/src/SparseLU/SparseLU.h:421:6: error: no match for call to ‘(Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<long int> >::OrderingType {aka Eigen::COLAMDOrdering<long int>}) (Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<long int> >::NCMatrix&, Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<long int> >::PermutationType&)’
   ord(m_mat,m_perm_c);
      ^
In file included from /home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/OrderingMethods:70:0,
                 from /home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/Sparse:27,
                 from /home/manawy/princeton/progra/specmicp/src/dfpm/solver/parabolic_program.hpp:40,
                 from /home/manawy/princeton/progra/specmicp/src/dfpm/1dtransport/diffusion.hpp:46,
                 from /home/manawy/princeton/progra/specmicp/src/reactmicp/equilibrium_curve/eqcurve_coupler.hpp:41,
                 from /home/manawy/princeton/progra/specmicp/src/reactmicp/equilibrium_curve/eqcurve_coupler.cpp:35:
/home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/src/OrderingMethods/Ordering.h:128:10: note: candidate: template<class MatrixType> void Eigen::COLAMDOrdering<StorageIndex>::operator()(const MatrixType&, Eigen::COLAMDOrdering<StorageIndex>::PermutationType&) [with MatrixType = MatrixType; StorageIndex = long int]
     void operator() (const MatrixType& mat, PermutationType& perm)
          ^
/home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/src/OrderingMethods/Ordering.h:128:10: note:   template argument deduction/substitution failed:
In file included from /home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/SparseLU:44:0,
                 from /home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/Sparse:29,
                 from /home/manawy/princeton/progra/specmicp/src/dfpm/solver/parabolic_program.hpp:40,
                 from /home/manawy/princeton/progra/specmicp/src/dfpm/1dtransport/diffusion.hpp:46,
                 from /home/manawy/princeton/progra/specmicp/src/reactmicp/equilibrium_curve/eqcurve_coupler.hpp:41,
                 from /home/manawy/princeton/progra/specmicp/src/reactmicp/equilibrium_curve/eqcurve_coupler.cpp:35:
/home/manawy/princeton/progra/specmicp/../eigen-hg/Eigen/src/SparseLU/SparseLU.h:421:6: note:   cannot convert ‘((Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<long int> >*)this)->Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<long int> >::m_perm_c’ (type ‘Eigen::SparseLU<Eigen::SparseMatrix<double, 0, int>, Eigen::COLAMDOrdering<long int> >::PermutationType {aka Eigen::PermutationMatrix<-1, -1, int>}’) to type ‘Eigen::COLAMDOrdering<long int>::PermutationType& {aka Eigen::PermutationMatrix<-1, -1, long int>&}’
   ord(m_mat,m_perm_c);
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You should replace typename MatrixT::Index by typename MatrixT::StorageIndex, see http://eigen.tuxfamily.org/index.php?ti ... ex_typedef
fgeorget
Registered Member
Posts
7
Karma
0
Indeed ! Thanks a lot, I did not make the link at all.

Does a clever method exist to be compatible with both versions of Eigen or do we need to play with #ifdef ?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You can use StorageIndex in both version.
fgeorget
Registered Member
Posts
7
Karma
0
Unfortunately, my compiler disagrees with that. This is the compilation error I get with Eigen 3.2.8 when using StorageIndex :

Code: Select all
specmicp/src/specmicp_common/sparse_solvers/sparse_qr.hpp: In instantiation of ‘class specmicp::sparse_solvers::SparseSolverQR<Eigen::SparseMatrix<double, 0, int>, Eigen::Matrix<double, -1, 1>, Eigen::Matrix<double, -1, 1> >’:
[....]
specmicp/src/specmicp_common/sparse_solvers/sparse_qr.hpp:59:100: error: no type named ‘StorageIndex’ in ‘class Eigen::SparseMatrix<double, 0, int>’
     using SolverT = Eigen::SparseQR<MatrixT, Eigen::COLAMDOrdering<typename MatrixT::StorageIndex>>;
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
sorry, my "eigen3.2" folder was temporally pointing to the devel branch when I checked. I guess we should add this typedef to ease the transition. In the meantime you can still do something like:

#if EIGEN_VERSION_AT_LEAST(3.2.90)
#define STORAGE_INDEX_TYPE(TYPE) TYPE::StorageIndex
#else
#define STORAGE_INDEX_TYPE(TYPE) TYPE::Index
#endif
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
fgeorget
Registered Member
Posts
7
Karma
0
ahah that's better than what I did, I was using CMake to get the Eigen version...

Thanks a lot for all you work and help !
alanking
Registered Member
Posts
1
Karma
0
I had to change

Eigen::SparseLU<Eigen::SparseMatrix<double, Eigen::ColMajor>, Eigen::COLAMDOrdering<Eigen::Index> > solver;

to

Eigen::SparseLU<Eigen::SparseMatrix<double, Eigen::ColMajor>, Eigen::COLAMDOrdering<int> > solver;

The compiler translated Eigen::Index to long int and threw the error described above.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]