'Index type not supported yet' error when doing QR factorization using Eigen and SuiteSparseQR

Environment

Windows 10 21H1 / MSVC C++ 14 / eigen 3.3.7 / suitesparse  5.3.0

Error Specification

Assertion failed: false && "Index type not supported yet", file C:\vcpkg\installed\x64-windows\include\eigen3\Eigen\src/CholmodSupport/CholmodSupport.h, line 93

Solution

Just comment eigen_assert on line 93 of CholmodSupport.h.

Test Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <Eigen/Sparse>
#include <Eigen/SPQRSupport>
#include <Eigen/SparseCholesky>
#include <Eigen/OrderingMethods>
#include <vector>
#include <iostream>

typedef Eigen::SparseMatrix<double> SparseColMat;

int main(int argc, char** argv)
{

    SparseColMat m(4, 3);
    m.coeffRef(0, 0) = -1; m.coeffRef(0, 1) = -1; m.coeffRef(0, 2) = 1;
    m.coeffRef(1, 0) = 1; m.coeffRef(1, 1) = 3; m.coeffRef(1, 2) = 3;
    m.coeffRef(2, 0) = -1; m.coeffRef(2, 1) = -1; m.coeffRef(2, 2) = 5;
    m.coeffRef(3, 0) = 1; m.coeffRef(3, 1) = 3; m.coeffRef(3, 2) = 7;

    std::cout << "Here is the matrix m:\n" << m << std::endl;

    Eigen::SPQR<SparseColMat> solver1(m);
    std::cout << "QR solver1 :\n"  << solver1.matrixR() << std::endl;

    m.makeCompressed();
    Eigen::SparseQR<SparseColMat, Eigen::COLAMDOrdering<int>> solver2(m);
    std::cout << "QR solver2 :\n" << solver2.matrixR() << std::endl;

    return 0;
}

Result



댓글

이 블로그의 인기 게시물

Linux에서 특정한 디렉토리가 차지하는 용량을 효율적이고, 빠르게 계산하는 법(Fast, efficient way to calculate directory size recursively on linux)

Proof of well-known 'Intersection Of Three Planes' formula.

선형대수와 군