#include "header.h" int main(void) { gsl_vector_float *b; // gsl_vector_float *ans; gsl_vector_float *x; gsl_matrix_float *A; float tol; // error int maxite; //maximum iterate int n; // length of vector x; /////////////////// input begins myin(&A,&b); // very tricky here, those are the addresses of the pointer to the float vector and matrix /////////////////// call the CG function to solve the equation n=(*b).size; x=gsl_vector_float_alloc(n); //!!!!!!!!!!!!!!!!!!!! gsl_vector_float_set_zero(x); //x=0; tol=TOL; //control the error maxite=MAXITE; //control the iterate fGC(A,x,b,tol,maxite); /* check the answer,yeah we are right! ans=gsl_vector_float_alloc(vn); gsl_blas_sgemv (CblasNoTrans,1.0,A,x,0.0,ans);//ans=Ax gsl_vector_float_fprintf(stdout,ans,"ans%lf"); gsl_vector_float_fprintf(stdout,b,"b%lf"); */ /////////////////output begins myout(x); //////////////// gsl_vector_float_free(x); gsl_vector_float_free(b); gsl_matrix_float_free(A); return 0; }