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

Building gigantic sparse matrix

Tags: None
(comma "," separated)
alphannine
Registered Member
Posts
3
Karma
0

Building gigantic sparse matrix

Fri Nov 28, 2014 4:26 pm
So... i'm kinda new to eigen, and i'm having some issues on performance here...

consider the following: i'm trying to build a Vertically arranged non-square matrix D, which is m x n sized, and changes at every iteration

a chunk of D is going to be a fixed normalized laplacian matrix A which is n x n
the next chunk is B, which has variable row size (but never bigger than n) and changes it's content at each iteration
and finally, a chunk C which is the biggest, being 6*n^2 x n but changing it's content at each iteration

A
B = D matrix
C


my question is: what would be the fastest way to build matrix D considering the variable sizes of B, fixed sized but changing content C and never changing A ?
alphannine
Registered Member
Posts
3
Karma
0

Re: Building gigantic sparse matrix

Tue Dec 02, 2014 2:11 pm
Alright... in the end, the speed problem was during the factorization of my matrix
Perhaps someone can shed some light on what i'm doing wrong?

I want to solve a least square system Ax = b for x
A is my my vertically arranged matrix consisting of a normalized laplacian matrix concatenated with a matrix consisting of rows with just a " 1 " on a random column

what i'm currently doing is:

Code: Select all
A = A.transpose()*A;
SimplicialLLT<SparseMatrix, Eigen::Upper>  lltSolver
lltSolver.analyzePattern(A);
lltSolver.factorize(A);
x = lltSolver.solve(b);


but factorizing is taking a very long time ... roughly 30 seconds, which becomes a toll as i need to re-factorize it again (A changes every step of the simulation)
would there be a better way to approach the problem ?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Building gigantic sparse matrix

Tue Dec 02, 2014 10:05 pm
If A is the assembly of a Laplacian matrix and rows implementing hard-constraints, then I would recommend you to implement these hard constraints by reordering the variable/equation to cluster the unknowns at the top while keeping the symmetry. Then you can split the matrix and move the fixed part to the right hand side. Regarding the normalization, don't put it in the Laplacian matrix but rather in a diagonal matrix D so that you can preserve the symmetry of the Laplacian matrix L:

D * L x = b <=> L x = D^-1 * b
alphannine
Registered Member
Posts
3
Karma
0

Re: Building gigantic sparse matrix

Wed Dec 03, 2014 2:20 pm
I don't think i follow you ):

here's a hypothetical example:

Image

where λ is just a weight factor (ignore it for now)

and

Image
so that the vertical arrangement composes A
b contains the delta coordinates for the laplacian and the absolute position of certain points for the hard constraints
i don't think i understand what you mean by keeping the symmetry or by splitting the matrix and moving only the fixed part

sorry for being a bit slow on the math over here ):
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS


Bookmarks



Who is online

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