Question

In: Computer Science

Given an n × n matrix A, write a function that carries out LU factoriza- tion...

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)

Solutions

Expert Solution

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.


Related Solutions

Write a function such that given a number N, display the N*N multiplication matrix from 1...
Write a function such that given a number N, display the N*N multiplication matrix from 1 to N. Then, write a C++ program such that, it prints the multiplication matrices of numbers 1,4,7, and 10 using a loop concept. Check the sample output below, to see how the program should work. Make sure to have your output exactly the same as the below output.
Write a MATLAB function function = myMatrixInveesion(....) to calculate matrix inversion by implementing LU decomposition, forward...
Write a MATLAB function function = myMatrixInveesion(....) to calculate matrix inversion by implementing LU decomposition, forward and backward substitution procedures. Do NOT use the built-in "lu" or "inv" commands in your code. You will need to employ Nested Loops. Thank you! function_____ = myMatrixInversion(_____)
Write a function matrix power(A, n) that computes the power An using Boolean arithmetic and returns...
Write a function matrix power(A, n) that computes the power An using Boolean arithmetic and returns the result. You may assume that A is a 2D list containing only 0s and 1s, A is square (same number of rows and columns), and n is an integer ≥ 1. You should call your previously written matrix multiply boolean function. Example: Let R = [ [0, 0, 0, 1], [0, 1, 1, 0], [0, 0, 0, 1], [0, 0, 1, 0] ]...
Write a Matlab function for a matrix that takes in a matrix in echelon form and...
Write a Matlab function for a matrix that takes in a matrix in echelon form and will return the row canonical form. The function cannot use rref, or any other matlab built in functions.
maximumST is a function that should take an n × n vector (representing the adjacency matrix...
maximumST is a function that should take an n × n vector (representing the adjacency matrix of a graph) as input and return the value of the maximum spanning tree of the graph defined by the n × n vector. Code: #include <vector> #include <cmath> #include <iostream> #include <cstdio> using namespace std; double maximumST( vector< vector<double> > adjacencyMatrix ){   vector<int> row(4,-1);   vector< vector<int> > matrix(5,row);   cerr << matrix.size() << endl;   cerr << matrix[0].size() << endl;   for( int i = 0;...
Write a C++ program that has a function which given n>=0, create an array length n*n...
Write a C++ program that has a function which given n>=0, create an array length n*n with the following pattern, shown here for n=3 : {0, 0, 1, 0, 2, 1, 3, 2, 1} (spaces added to show the 3 groups) generateGroups(3) → [0, 0, 1, 0, 2, 1, 3, 2, 1] generateGroups(2) → [0, 1, 2, 1] generateGroups(4) → [0, 0, 0, 1, 0, 0, 2, 1, 0, 3, 2, 1, 4, 3, 2, 1]
Write a recursive function to calculate and return factorial of a given number 'n'. in C...
Write a recursive function to calculate and return factorial of a given number 'n'. in C progrmaining
Write an evenTest(n) function that returns True if it is given an even integer and False...
Write an evenTest(n) function that returns True if it is given an even integer and False if it is given an odd number. The rest of your code (outside of the function) should get an integer number from the user, call evenTest(n) to test if the number is even, and then tell the user if the number was even or odd. Name the program even_or_odd.py. Part 2. Salary.py (5 pts) You are offered two options to receive salary: • Option...
Prove uniqueness of (a) LU-factorisation, (b) of LDU-factorisation of a square matrix.
Prove uniqueness of (a) LU-factorisation, (b) of LDU-factorisation of a square matrix.
Write a c++ function named multi_table to print out multiplication table for a given number of...
Write a c++ function named multi_table to print out multiplication table for a given number of rows and columns. Your program should print a header row and a header column to represent each row and column number. For example your function call multi_table(4, 4) would print below to the command line: 1 | 1 2 3 4 _________ 2 | 2 4 6 8 3 | 3 6 9 12 4 | 4 8 12 16 Test your function in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT