forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 11:26 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: LU Factorization
PostPosted: Fri Nov 25, 2011 6:39 pm 
Offline

Joined: Fri Nov 25, 2011 6:36 pm
Posts: 4
How can I (succesfully) unpack the information module rmatrixlu returns me in the first argument? I.e. i need the matrices L and U explicitely.


Top
 Profile  
 
 Post subject: Re: LU Factorization
PostPosted: Mon Nov 28, 2011 7:20 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Lower part of the result contains L, upper one contains U. They should be easy to unpack.


Top
 Profile  
 
 Post subject: Re: LU Factorization
PostPosted: Mon Nov 28, 2011 7:49 am 
Offline

Joined: Fri Nov 25, 2011 6:36 pm
Posts: 4
Sure, if this were it. What about the Permutation Matrix (Pivots) and the Decomposition A=P L U? I don't understand the function of the returned pivots in order to construct that Decomposition.


Top
 Profile  
 
 Post subject: Re: LU Factorization
PostPosted: Mon Nov 28, 2011 9:05 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Here is extract from documentation:

Quote:
A is represented as A = P*L*U, where:
* L is lower unitriangular matrix
* U is upper triangular matrix
* P = P0*P1*...*PK, K=min(M,N)-1,
Pi - permutation matrix for I and Pivots[I]


Top
 Profile  
 
 Post subject: Re: LU Factorization
PostPosted: Mon Nov 28, 2011 9:51 am 
Offline

Joined: Fri Nov 25, 2011 6:36 pm
Posts: 4
It seems we are talking past each other. Please take a look at this example (mycode)

LU Decomposition A = L U.
A:
2,000000 -1,000000 0,000000
1,000000 0,000000 -1,000000
3,000000 7,000000 -1,000000

The Decomposition of A is
L:
0,666667 1,000000 0,000000
0,333333 0,411765 1,000000
1,000000 0,000000 0,000000
U:
3,000000 7,000000 -1,000000
0,000000 -5,666667 0,666667
0,000000 0,000000 -0,941176

Now please consider the output of alglib routine rmatrixlux

---> LUA:
3,0000 7,0000 -1,0000
0,6667 -5,6667 0,6667
0,3333 0,4118 -0,9412
---> PIVOTS:
2 2 2

Matrix U can easily be extracted. But the construction of L is what is making me a headache when using alglib's rmatrixlu.


Top
 Profile  
 
 Post subject: Re: LU Factorization
PostPosted: Mon Nov 28, 2011 11:16 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
L is unitriangular, which means that its diagonal elements are equal to 1.0. In your case L is equal to
1,0000 0,0000 0,0000
0,6667 1,0000 0,0000
0,3333 0,4118 1,0000


Top
 Profile  
 
 Post subject: Re: LU Factorization
PostPosted: Mon Nov 28, 2011 12:40 pm 
Offline

Joined: Fri Nov 25, 2011 6:36 pm
Posts: 4
Which in this case would mean, that LU != A. And, what about the Pivots? I know i am intrusive, and i am really sorry about that, but i hope to solve this (little) problem with your very appreciated help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group