Registered Member
|
fatal error: slu_Cnames.h: No such file or directory
i got this error message when i tried running the following code: #define EIGEN_SUPERLU_SUPPORT #include <iostream> #include <Eigen/Sparse> #include <vector> typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double typedef Eigen::Triplet<double> T; #include <Eigen/SparseCore> #include <Eigen/SuperLUSupport> using namespace Eigen; using Eigen::MatrixXd; using namespace std; int main() { MatrixXd m(5, 5); int row = 5, col = 5; SparseMatrix<double> mat(row, col); m << 2, 3, 0, 0, 0, 3, 0, -1, 0, 4, 0, 4, -3, 1, 2, 0, 0, 2, 0, 0, 0, 6, 0, 0, 1; for (int c = 0; c < m.cols(); c++) for (int r = 0; r < m.rows(); r++) { // cout<<m(r,c)<<endl; if (m(r, c) != 0) mat.insert(r, c) = m(r, c); } for (int k = 0; k < mat.outerSize(); ++k) for (SparseMatrix<double>::InnerIterator it(mat, k); it; ++it) { cout << it.value(); cout << " row: " << it.row(); // row index cout << " col: " << it.col(); // col index (here it is equal to k) cout << " indx: " << it.index() << endl; // inner index, here it is equal to it.row() } VectorXd b(row), x(row); b << 8., 45., -3., 3., 19.; SuperLU<SparseMatrix<double> > solver; solver.compute(mat); cout << "compute result:: " << solver.info() << endl; if (solver.info() != 0) { cout << "decomposition failed" << endl; return 0; } x = solver.solve(b); if (solver.info() != 0) { cout << "solving failed" << endl; return 0; } // solve for another right hand side: x = solver.solve(b); cout << "solution: " << endl; for (int i = 0; i < row; i++) cout << x(i) << endl; return 0; } Can someone help me. What did i get wrong? |
Moderator
|
To use SuperlU, you need to configure your project so that the compiler can find SuperLU headers and link to superlu library and its dependencies.
In the devel branch, we have a built-in SparseLU solver that does not require any dependecy. |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]