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

Sparse matrix. I have some trouble...

Tags: None
(comma "," separated)
faustom
Registered Member
Posts
3
Karma
0
Hello,
In order to run an image segmentation method based on graphs (it's called random walks) the Dirichlet problem must be solved.

I have a sparse matrix L (Laplacian), I need to select just some part of this matrix.
As far as i understood this is not possible using the sparse matrix implemented in Eigen.

I will attach a link with a picture to explain the problem i want to solve.

http://imageshack.us/photo/my-images/854/todoj.png/

Is there any possibility to implement it efficiently? I must use the sparse approach since the matrix is 262'144x262'144 big.
I'm currently thinking about some other possiblity but i'm quite unfamiliar with Eigen since i started using it just today!
faustom
Registered Member
Posts
3
Karma
0
for example if there is a way to remove the rows and the columsn which are *COMPLETELY* filled by zeros....
faustom
Registered Member
Posts
3
Karma
0
ok, i have solved that problem!now i have troubles solving the system itself.

as depicted in figure i have the matrix B, the matrix M, the matrix Lu.

http://imageshack.us/photo/my-images/854/todoj.png/

i need to solve for the unknowns you can see in the figure, how can i do it?? i tried

Code: Select all
   //computation of the right hand part of the expression: Bt^T*M
   SpMat b(unlabeled_counter,max_hash);

   b=-Bt*M;

   //system solution

   Eigen::SimplicialCholesky<SpMat> chol(Lu);
   Eigen::MatrixXd X = chol.solve(b);


but i know that it can't work. i tried also to do exactly as stated in the example on the page explaining she sparse matrices but it does not work.

Please help me!!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Are you sure Lu is always symmetric? If so, the only problem I think is that X and b should be both dense or both sparse. I'd recommend to go for the both dense solution:

MatrixXd b = (-Bt*M).eval();


Bookmarks



Who is online

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