Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Suppose that a matrix A has a factorization of the form A = BBT, with B nonsingular. Show that A must be a)
1. Suppose that a matrix A has a factorization of the form A = BBT, with B nonsingular. Show that A must be a) symmetric, and b) positive definite, that is, xAx> 0 for x/= 0. Matrices with both these properties are called symmetric positive definite (SPD) matrices, and they are an important class of matrices. In this question, you shall develop a special form of LU factorization for them. 3. Generalizing the previous part, find an algorithm that computes the Cholesky factor L for a given symmetric, positive-definite matrix A of size nxn. Hints: a) Start with 111 and proceed through rows. b) Finish computing each row of L before moving on to the next one. c) Only one half of the matrix (lower half) A needs to be accessed. 4. Implement the algorithm devised in previous part, and run it on three random SPD matrices of size 20 x 20. Here is some Python code to make a random SPD matrix: import numpy as np def rand_spd(n): A = np.random.rand(n,n) return np.dot(A, A.T) For each test case, print the relative error IILLT -A||2/||A||2, where L is your computed Cholesky factor. the condition number of the matrix, as found by numpy.linalg.cond. Note that there is no need for pivoting. 5. Compute the determinant of three random SPD matrices (of sizes 5, 10 and 100, com- puted as above) using their Cholesky factors and compare the results with the deter- minant obtained using the numpy.linalg.det() function. For each example, print the following: the size of the matrix n, the value from numpy.linalg.det(), your computed determinant, and the relative error between the two,assuming result from numpy.linalg.det() to be the true value. Hints: det(AB) = det(A) det(B), . the determinant of a triangular matrix is the product of its diagonal entries. .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
output import numpy as np Function to compute Cholesky decomposition def choleskydecompositionA n As...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started