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

triangular solve

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

triangular solve

Tue Feb 05, 2013 5:00 pm
Hi,
I have an Eigen matrix (say MatrixXd A) with the following structure A = [A1;0;A2;0;A3], where A1, A2 and A3 are blocks (of rows) separated by blocks of zeros. If there are no zero blocks in between the "meaningful" entries of A, A happens to be upper triangular, so I could directly use e.g.,

Code: Select all
X = A.triangularView<Upper>().solve<OnTheRight>(B);


where B and X are matrices with appropriate dimensions. What would be a reasonable/efficient approach for handling the case when there are blocks of zeros separating the data, and noting that even if there are zero blocks (of rows) in A, the matrix B has the same dimensions as before? Before implementing a dedicated routine myself, I was wondering whether there are "tricks" in Eigen that could be used to accomplish this (e.g., by using Map and then the builtin triangular solvers).

As an example consider the matrix A below

Code: Select all
A = [1 2 3 4 5 6 7; 0 1 2 3 4 5 6; 0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 1 2 3 4 5; 0 0 0 1 2 3 4; 0 0 0 0 0 0 0; 0 0 0 0 0 0 0; 0 0 0 0 1 2 3;0 0 0 0 0 1 2; 0 0 0 0 0 0 1]


Note that the row size of A1, A2, A3 as well as the row size of the zero blocks could be arbitrary.

Thanks
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: triangular solve

Wed Feb 06, 2013 7:55 am
You can either fill a SparseMatrix and let Eigen does the job scalar-wise (http://eigen.tuxfamily.org/dox-devel/gr ... parse.html) or exploit the blocking structure yourself by write your own solver on top of Eigen's triangular solves and products (using .block(...) or Map<>).
ddimitrov
Registered Member
Posts
4
Karma
0

Re: triangular solve

Fri Feb 08, 2013 12:17 am
Most probably the second option would be better.
Thanks.


Bookmarks



Who is online

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