I am not able to do complete pivoting in matlab. Say I have some matrix that is not sparse:
A = [0,1,1,1;0,1,0,0;1,1,1,1;0,0,0,-1]
When I try to use the lu command in matlab it does not like it because it is not sparse:
>> [L,U,P,Q] = lu(A)
Error using lu
Too many output arguments.
Even the docs say that it must be sparse:
[L,U,P,Q] = lu(A) for sparse nonempty A, returns a unit lower triangular matrix L, an upper triangular matrix U, a row permutation matrix P, and a column reordering matrix Q, so that PAQ = L*U. If A is empty or not sparse, lu displays an error message. The statement lu(A,'matrix') returns identical output values.
I have two questions about this:
1) Why must it be sparse? In theory LU decomposition works for non-sparse matrices and so does complete pivoting.
2) What is the appropriate MATLAB method to call to do complete pivoting for non-sparse matrices?
Qoutput, only thatA*Q'may be used as an input, so this option must have been added later.