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

Incorrect computation of determinant of sparse matrices?

Tags: None
(comma "," separated)
eteufl
Registered Member
Posts
5
Karma
0
OS
I want to compute the determinant of a sparse matrix using SparseLU and absDeterminant(), signDeterminant(). However, I get incorrect results:
Code: Select all
#include <iostream>
#include <Eigen/Dense>
#include <Eigen/Sparse>

using namespace std;
using namespace Eigen;

int main() {
   MatrixXd m(2,2);
   m << 2,1,1,1;
   cout << "det=" << m.determinant() << endl;
   SparseMatrix<double> sm = m.sparseView();
   SparseLU<SparseMatrix<double> > slu;
   slu.compute(sm);
   cout << "det=" << slu.absDeterminant() << endl;
}

Did I miss something?

The documentation of absDeterminant and logAbsDeterminant mentions QR decomposition. I think the LU decomposition is meant. Also logAbsDeterminant refers to **this which should be *this.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
eteufl
Registered Member
Posts
5
Karma
0
OS


Bookmarks



Who is online

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