#include "header.h" // my function to read from input int myin(gsl_matrix_float **A,gsl_vector_float **b) { int vn; //the lenght of the vector; also it should be same to the number of the rows of the matrix A! int n; // the number of the rows of the matrix A. int m; // the number of the columns of the matrix A. char matrixfile[MAXFILELEN]; //to storage the input matrix file name char vectorfile[MAXFILELEN]; //to storage the input vector file name FILE *fin; // to read matrix and vector from the file /////////////////// input begins //////////// read in the names of matrix and vector scanf("%s",matrixfile); scanf("%s",vectorfile); //////////// read in the matrix from the standard input stream. fin=fopen(matrixfile,"r"); fscanf(fin,"%d",&n); fscanf(fin,"%d",&m); (*A)=gsl_matrix_float_alloc(n,m); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!! gsl_matrix_float_fscanf (fin,*A); /////////// read in the vector from the standard input stream. //printf("-------------------------------------------------\n"); fin=fopen(vectorfile,"r"); fscanf(fin,"%d",&vn); (*b)=gsl_vector_float_alloc(vn); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! gsl_vector_float_fscanf (fin,*b); fclose(fin); return 1; } // my function to output the result and free the memery alloc from "myin" function int myout(gsl_vector_float *x) { printf("the solution of the equation Ax=b is: \n"); gsl_vector_float_fprintf(stdout,x,"%lf"); return 1; }