#include "header.h" int main(void) { gsl_matrix *A; gsl_matrix *A2; gsl_vector *seigen; int n,m,ss; // dimentions of A; float Tol=10.0E-6; scanf("%d",&n); scanf("%d",&m); A=gsl_matrix_alloc(n,m); A2=gsl_matrix_alloc(n,m); seigen=gsl_vector_alloc(n); // read in the matrix gsl_matrix_fscanf (stdin,A); //gsl_matrix_fprintf(stdout,A,"%lf"); // check the matrix is symeetric or not if (!check(A,n)) { printf("matrix A is not symmetric"); return 0; } //printf("the i,j the value of matrix A is %lf.",check1); gsl_matrix_memcpy(A2,A); // call the decomposition function ss=QREvals(A,seigen,n,Tol); printf("the total number of iteration is%d\n",ss); // use build-in function gsl_eigen_symmv_workspace * w = gsl_eigen_symmv_alloc (n); gsl_vector *eigen2 = gsl_vector_alloc (n); gsl_matrix *eigenvector = gsl_matrix_alloc (n, n); gsl_eigen_symmv (A2, eigen2, eigenvector, w); printf("the following are the eigenvaluse by build-in function\n"); gsl_vector_fprintf(stdout,eigen2,"%lf"); return 1; }