/* Midterm Part 2 Extra Credit Let A be a nxn invertible matrix. Consider the algorithm Repeatedly factorize A = QR and replace A with RQ described on page 122 of Numerical Algorithms by Justin Solomon. Write a program that implements this algorithm using one of the QR factorization routines written in class. Note that since A is square, then R and Q are also square. Under certain conditions the diagonal elements of R will converge to the eigenvalues of A up to a possible sign difference as the program runs. Starting with the matrix contained in the file extra.c print the diagonal elements of R at each iteration to show whether and how they converge. */ #include #include #include #include #include #include "matrixlib.h" double dotprod(int n,double x[n],double y[n]){ double s=0; for(int i=0;i=0;j--){ hheliminate(m,n,Hs[j],Q); } for(int i=0;ij) R[i][j]=0; } } } void diagprint(int n,double A[n][n]){ for(int i=0;i=50) break; bzero(A,sizeof(double)*N*N); for(int i=0;i