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

Factorization Time of SparseQR

Tags: None
(comma "," separated)
navalgupte
Registered Member
Posts
4
Karma
0

Factorization Time of SparseQR

Fri Apr 18, 2014 8:08 pm
Hi,

I am trying to factorize a mxn matrix (m>n) using SparseQR. The matrix size is 25700 x 12700. However, the factorization step runs for a few hours after which I had to termnate the process. Below is the code that I tried.

//Create Eigen Matrix From Triplets
SparseMatrix<double, ColMajor, long> N(nRows, mCols);
N.setFromTriplets(cscVectors.begin(), cscVectors.end());

cout << "Building QR Solver..\n";

//Get Inv(N)
SparseQR< SparseMatrix<double, ColMajor, long>, COLAMDOrdering<long> > qrSolver;

//Compute Fill-Reducing Ordering For N
qrSolver.analyzePattern(N);
if(qrSolver.info() != Success) {
cout << "Ordering Failed.. " << qrSolver.lastErrorMessage() << "\n";
return false;
}

//Numeircal Factorization Of N
qrSolver.factorize(N); //Code just seems to stop here
if(qrSolver.info() != Success) {
cout << "Decomposition Failed.. " << qrSolver.lastErrorMessage() << "\n";
return false;
}

What can I do to speed up this time?

Thanks,
Naval
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Factorization Time of SparseQR

Sat Apr 19, 2014 8:29 am
Are you sure that the compiler optimizations are ON? What about the number of non-zeros? Do you have a full row or column? For such a matrix it should not take more than 1 or 2 seconds. Have you tried with 'int' instead of 'long' for the index types? I'm not 100% sure that SparseQR has been properly checked with long.
navalgupte
Registered Member
Posts
4
Karma
0

Re: Factorization Time of SparseQR

Sun Apr 20, 2014 1:24 am
Hi,

Thanks for your reply. I am trying with "int" now. However, I also had a few other concerns too. When I compile the code, I get these warnings..

../../../Eigen/src/OrderingMethods/Eigen_Colamd.h:742: warning: converting to ‘int’ from ‘double’
../../../Eigen/src/OrderingMethods/Eigen_Colamd.h:743: warning: converting to ‘int’ from ‘double’

Is it safe to ignore these warnings?
What optimization level do you suggest?

Thanks,
Naval
navalgupte
Registered Member
Posts
4
Karma
0

Re: Factorization Time of SparseQR

Mon Apr 21, 2014 2:19 pm
Hi,

Below are the answers to your questions..

Are you sure that the compiler optimizations are ON?

It was previously OFF. I tried using -O first, and then later tried with -O2. Same thing. Code just seems to get stuck at factorization step. I have to abort it after that.

What about the number of non-zeros?

Matrix size that I am currently working on is 25372 x 12703, with number of non-zeros 31274422. Acutally the matrix is supposed to be 25372 x 25372, but I remove the empty columns before I hand over the matrix to Eigen.

Do you have a full row or column? For such a matrix it should not take more than 1 or 2 seconds.

No.

Have you tried with 'int' instead of 'long' for the index types? I'm not 100% sure that SparseQR has been properly checked with long.

Tried using 'int' too. However, same thing.

As pointed out in my previous post, I get those warning messages. I tried to run the code ignoring those warnings. Is that safe?

Thanks,
Naval
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Factorization Time of SparseQR

Mon Apr 21, 2014 8:37 pm
Your matrix has about 2600 entries per columns, so regardless of the re-ordering, the factors are very likely to be dense and prohibitive to compute, especially for our simplicial sparse QR. You might consider using an iterative solver.


Bookmarks



Who is online

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