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

Solving Ax=b with sparse matrix

Tags: None
(comma "," separated)
bodrak
Registered Member
Posts
1
Karma
0
OS

Solving Ax=b with sparse matrix

Sat May 29, 2010 2:07 pm
Hello everyone,

I am working on a project of image processing on the iphone, i am using a mac and xcode, and I need to solve the equation Ax=b using sparse matrix.
On the tutorial there is only a way to do this with dense matrix, is it possible to do it with sparse one with eigen? if yes, what is the code to use? If no, what do you suggest to me to use? (Something not too much complicated).

Ideally I need that but for a sparse matrix A : A.llt().solve(b,&x);

Or maybe if it is easier to do : x = (A.transpose() * A)^-1 * A.transpose() * b

The matlab code of what I search is : x = lsqr(A,b,1e-03,500);

I tried something like that, but it doesn't work.

DynamicSparseMatrix<double> matrixA(num_constraints,ws*hs);
//SparseVector<double> vectorB(num_constraints);
VectorXf vectorB(num_constraints);
//Fill the sparse matrix and vector
SparseMatrix<double> matA(matrixA);

VectorXf x(num_constraints);
x.setZero(num_constraints);
SparseLU<SparseMatrix<double>, SuperLU> slu(matA);
slu.solve(vectorB, &x);

Error at running time:
Assertion failed: (false && "not implemented yet"), function compute, file /Users/.../Eigen/src/Sparse/SparseLU.h, line 136.

Does that mean it is not yet implemented? or do I something wrong?

Regards,
Bodrak
duetosymmetry
Registered Member
Posts
18
Karma
0

Re: Solving Ax=b with sparse matrix

Tue Jun 01, 2010 4:05 pm
You're trying to use the SuperLU library backend to do your decomposition.
Did you include SuperLUSupport.h? I thought this was necessary for whichever backend you were trying to use.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Solving Ax=b with sparse matrix

Wed Jun 02, 2010 12:12 pm
using one of our solver backends on the iphone might be pretty tough! If your matrix is selfadjoint, I recommend you to use our built-in SparseLDLT decomposition/solver.


Bookmarks



Who is online

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