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

[SOLVED] solving the trasponsed/adjoint system with SparseLU

Tags: None
(comma "," separated)
moritz
Registered Member
Posts
12
Karma
0
Hi,

I'm currently using SparseLU with SuperLU to solve equations of the form A * x == b, and I also need the solutions for A.adjoint() * x == b. I didn't find a way to do this without doing an extra LU decomposition on A.adjoint() - is there a simple one?

I've read somewhere the the LU decomposition for the transposed matrix is the same as for the original, so it shouldn't be too hard, but I found nothing in the documentation.

Cheers,
Moritz
User avatar
bjacob
Registered Member
Posts
658
Karma
3
I don't know any specifics about the Sparse module, but that doesn't seem entirely obvious to me.

It's true that if A = LU then A^* = U^* L^* and U^* is lower-triangular and L^* is uppertriangular.

So yes, from the LU dec of A you get an LU dec of A^*, however, the assumption that L has unit diagonal becomes that now L^* has, i.e. the "U" in the dec of A^*. So the solver part, doing successive triangular solves, needs to be written in a slightly different way.

You could do that in your own program, inspiring from Eigen's code; then it's a good question whether to include that in Eigen, but I'm not feeling competent here.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
superLU is able to solve for A^T x = , so I guess this would not be difficult to add that possibility in the SuperLU backend
moritz
Registered Member
Posts
12
Karma
0
ggael wrote:superLU is able to solve for A^T x = , so I guess this would not be difficult to add that possibility in the SuperLU backend


It's indeed not very hard, even I managed to do that with my limited C++ knowledge ;-)

Here's an initial patch, still lacking documentation: http://nopaste.snit.ch/16132

If you think the direction is right, I can spend some more time on it, updating the docs and perhaps adding few more tests.

Speaking of tests: how do I build the tests locally, with all my local modifications? A simple "cmake ."in the test/ directory complains that EigenTesting can't be included.
(Or should I go to the mailing lists with such questions?)
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
good !

so, to run the unit tests simply do as usual:

mkdir build
cd build
cmake path_to_eigen2 -DEIGEN_BUILD_TESTS=on
cd test

from this point you can:
- build all tests: make
- run a specific test: ./test_XXX
- build and run all tests: ctest
- build and run all tests with more feedback: ctest -V
- build and run all tests matching a regexp with feedback: ctest -V -R sparse

about your patch, it would be much better to use named values. Since we cannot use Transpose, I suggest: SvNoTrans, SvAdjoint, SvTranspose
moritz
Registered Member
Posts
12
Karma
0
ggael has applied my re-worked patched in the mean time, so the SuperLU bindings do what I want them to now. Thank you very much!


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell