GSL读取向量数据存储文件

#include <stdio.h>
#include <gsl/gsl_vector.h>

#pragma comment(lib, "libgsl_d.lib")
#pragma comment(lib, "libgslcblas_d.lib")

int
main (void)
{
  int i; 
  gsl_vector * v = gsl_vector_alloc (10);

  {  
     FILE * f = fopen ("test.dat", "r");
     if (NULL != f) {
         gsl_vector_fscanf (f, v);
         fclose (f);

         for (i = 0; i < 10; i++)
         {
             printf ("%g\n", gsl_vector_get(v, i));
         }

         return 0;
     }
     else {
         printf ("Could not open test.dat\n");
         return 1;
     }
  }

}

GSL读取向量数据存储文件_第1张图片

你可能感兴趣的:(GSL读取向量数据存储文件)