In: Computer Science
Given an n × n matrix A, write a function that carries out LU factoriza- tion without row pivoting. Note that this will be different from the built-in Matlab function lu, which does do row pivoting. (Using MATLAB)
MATLAB's lu always performs pivoting by default.if you had for example a diagonal coefficient that was equal to 0 when you tried to do the conventional LU decomposition algorithm,it will not work as the diagonal coefficients are required .When performing the Gaussian elimination to create the upper triangular matrix U so you would get a divide by zero error.pivoting is required to ensure that the decomposition is stable.
However,if you can guarantee that the diagonal coefficients of your matrix are diagonal non-zero,it is very simple but you will have to write this on your own.All you have to do is perform Gaussian elimination on the matrix and reduce the matrix into reduced echelon form. The result reduced echelon form matrix is U while the coefficients required to remove the lower triangular part of L in Gaussian elimination would be placed in the lower triangular half to make U.
Something like this could work,assuming your matrix is stored in A. We are using a square matrix i.e., (n*n) here. The implementation of non-pivoting LU decomposition algorithm is placed in a MATLAB function file called lu_nopivot :
Please view the attached images for the derivation and examples.