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

Changing Index type: EIGEN_DEFAULT_DENSE_INDEX_TYPE

Tags: eigen, index, eigen, index, indexing, cmake eigen, index, eigen, index, indexing, cmake eigen, index, eigen, index, indexing, cmake
(comma "," separated)
dimitr
Registered Member
Posts
6
Karma
0
Hi,

I want to change the default index type with EIGEN_DEFAULT_DENSE_INDEX_TYPE
What is the correct way to do it?

I added the following line in my CMakeLists.txt:

Code: Select all
add_definitions(-DEIGEN_DEFAULT_DENSE_INDEX_TYPE="int")


but I get errors such as:

Code: Select all
In file included from /cad2/Eigen/eigen-3.2/include/Eigen/Core:255:0,
                 from /users/ddakop/dev/nured/trunk/src/net/lmatrix.hpp:9,
                 from /users/ddakop/dev/nured/trunk/src/net/lmatrix.cpp:1:
/cad2/Eigen/eigen-3.2/include/Eigen/src/Core/util/XprHelper.h:27:9: error: expected unqualified-id before string constant
In file included from /cad2/Eigen/eigen-3.2/include/Eigen/Core:276:0,
                 from /users/ddakop/dev/nured/trunk/src/net/lmatrix.hpp:9,
                 from /users/ddakop/dev/nured/trunk/src/net/lmatrix.cpp:1:
/cad2/Eigen/eigen-3.2/include/Eigen/src/Core/Functors.h:612:55: error: ‘DenseIndex’ has not been declared
In file included from /cad2/Eigen/eigen-3.2/include/Eigen/Core:278:0,
                 from /users/ddakop/dev/nured/trunk/src/net/lmatrix.hpp:9,
                 from /users/ddakop/dev/nured/trunk/src/net/lmatrix.cpp:1:
/cad2/Eigen/eigen-3.2/include/Eigen/src/Core/DenseBase.h: In function ‘void Eigen::internal::check_DenseIndex_is_signed()’:
/cad2/Eigen/eigen-3.2/include/Eigen/src/Core/DenseBase.h:21:3: error: ‘DenseIndex’ was not declared in this scope
/cad2/Eigen/eigen-3.2/include/Eigen/src/Core/DenseBase.h:21:3: error: template argument 1 is invalid


Am I missing something? I know that it may be a cmake-related question but even when I added on top of my main.cpp

Code: Select all
 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int


I still had (other) compilation problems:

Code: Select all
/cad2/Eigen/eigen-3.2/include/Eigen/src/Core/products/GeneralMatrixMatrix.h:69:43: error: no matching function for call to ‘min(long long int&, Eigen::DenseIndex)
/cad2/Eigen/eigen-3.2/include/Eigen/src/Core/products/GeneralMatrixMatrix.h:69:43: note: candidates are:
In file included from /cad2/gcc/gcc-4.7.2/dist/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/memory:64:0,
                 from /users/ddakop/dev/nured/trunk/src/nured.hpp:23,
                 from /users/ddakop/dev/nured/trunk/src/nured.cpp:19:
/cad2/gcc/gcc-4.7.2/dist/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algobase.h:187:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
/cad2/gcc/gcc-4.7.2/dist/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algobase.h:187:5: note:   template argument deduction/substitution failed:
In file included from /cad2/Eigen/eigen-3.2/include/Eigen/Core:330:0,
                 from /cad2/Eigen/eigen-3.2/include/Eigen/Dense:1,
                 from /users/ddakop/dev/nured/trunk/src/nured.hpp:26,
                 from /users/ddakop/dev/nured/trunk/src/nured.cpp:19:
/cad2/Eigen/eigen-3.2/include/Eigen/src/Core/products/GeneralMatrixMatrix.h:69:43: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘Eigen::DenseIndex {aka long int}’)


showing data-type mismatches...
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Regarding the first issue, remove the " around "int". For the other errors, it seems that's in some places we are assuming that DenseIndex==ptrdiff_t. Feel free to propose a patch.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell