Code covered by the BSD License  

Highlights from
Gauss elimination with complete pivoting

3.55556

3.6 | 10 ratings Rate this file 51 Downloads (last 30 days) File Size: 1.42 KB File ID: #13451

Gauss elimination with complete pivoting

by Nickolas Cheilakos

 

19 Dec 2006 (Updated 23 Dec 2011)

This function calculate Gauss elimination with complete pivoting

| Watch this File

File Information
Description

This function calculate Gauss elimination with complete pivoting.

G)aussian (E)limination (C)omplete (P)ivoting
Input
A nxn matrix
Output
L = Lower triangular matrix with ones as diagonals
U = Upper triangular matrix
P and Q permutations matrices so that P*A*Q = L*U

examples :
[L U] = gecp(A);
[L U P] = gecp(A);
[L U P Q] = gecp(A);

Acknowledgements
This submission has inspired the following:
LU factorization with complete pivoting.
MATLAB release MATLAB 5.3 (R11)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (12)
20 Dec 2006 Duane Hanselman

This submission uses good syntax and does not ignore vectorization, but (a) it does not use standard MATLAB help such as the H1 line or describe the order of the output arguments, (b) it does not say that this is educational code since the built in function LU does what this function does already so it has no other practical use, (c) it does not have any internal comments that would provide educational value to the user.

After appropriate revision, this is a welcome addition to the FEX. Perhaps there should be an "educational algorithm implementation" category, so that no one confuses code such as this with something already built in to MATLAB.

20 Dec 2006 Dimitris Simos

I give a 4 out of 5 rating to this submission. It is a really good implementation of GECP, taking full advantage of matlab vectorizing capabililities. I don;t give a 5 to 5 rating, due to the lack of documentation.

I agree with Duane only to one point, to the H1 line; this should point to % GECP Gaussian Elimination Complete Pivoting...

Duane, I firmly believe that you are judging too hard this submission.

Firsty, the built-in function of LU, does partial pivoting and not complete pivoting. So, this submission is worthy of its place here. In addition, an implementation of GECP, so far to my knowledge is wanted in many universities in courses of Numerical Linear Algebra.

20 Dec 2006 mpampix short  
21 Dec 2006 Jonh Adams

I agree with Dimitris' comments. LU does partitial pivoting and not complete.

In courses of Numerical Linear Algebra Gauss elimination with complete pivoting is very usefull.

I don't give 5 beucause the lack of documentetion.

21 Dec 2006 Nick Cheilakos

I promise to update soon the documentation. But now I have a problem and I can't do it now.

Why someone use this function?

If you want to find some data about the growth of this method you can't use lu. (Because lu use partitial pivoting)

Also you can use it if you want to study the pivot structure of Hadamard matrices.

25 Dec 2006 rachid el moustachir  
30 Dec 2006 John Trevor

Very Useful

29 Sep 2007 Kate Mouzakis  
10 Jan 2008 daman chadha

plewase details with example

10 Jan 2008 daman chadha

example mail

21 Jun 2008 sid s

Somethings wrong in the calculation of Q. We do not get L*U==P*A*Q;
Consider the matrix below with 1 on the diagonal, -1 in the lower triangle and 1 on the last column. The code below plots the error between L*U and P*A*Q and it is definitely not zero.

N=10;
A=ones(N,N);
A=A-2*tril(A,-1)-triu(A,1);
A(:,N)=1;

[L,U,P,Q]=gecp(A);
mesh(abs(L*U-P*A*Q));

If its just a convention mistake then this is a good code.

25 May 2010 Dario

it seems, this doesn't compute P,L,U,Q such that P*A*Q = L*U
but such that A = P*L*U*Q or equivalently P'*A*Q' = L*U

Please login to add a comment or rating.
Updates
23 Dec 2011

Some errors corrected

Tag Activity for this File
Tag Applied By Date/Time
linear algebra Nickolas Cheilakos 22 Oct 2008 08:53:20
gauss Nickolas Cheilakos 22 Oct 2008 08:53:20
gaussian Nickolas Cheilakos 22 Oct 2008 08:53:20
elimination Nickolas Cheilakos 22 Oct 2008 08:53:20
complete elimination Nickolas Cheilakos 22 Oct 2008 08:53:20

Contact us at files@mathworks.com