00001
00002
00003
00004
00005
00006
00007 #include <WINDOWS.H>
00008 #include <stdio.h>
00009 #include <math.h>
00010 #include <malloc.h>
00011
00012
00013 void test_func(double *, double *,int,int,int);
00014
00015 double *OShift,*M,*y,*z,*x_bound;
00016 int ini_flag=0,n_flag,func_flag;
00017
00018
00019 void main()
00020 {
00021 int i,j,k,n,m,func_num;
00022 double *f,*x;
00023 FILE *fpt;
00024
00025 m=2;
00026 n=10;
00027
00028 fpt=fopen("input_data/shift_data.txt","r");
00029 if (fpt==NULL)
00030 {
00031 printf("\n Error: Cannot open input file for reading \n");
00032 }
00033 x=(double *)malloc(m*n*sizeof(double));
00034 if (x==NULL)
00035 printf("\nError: there is insufficient memory available!\n");
00036 for(i=0;i<n;i++)
00037 {
00038 fscanf(fpt,"%Lf",&x[i]);
00039 printf("%Lf\n",x[i]);
00040 }
00041 fclose(fpt);
00042
00043 for (i = 1; i < m; i++)
00044 {
00045 for (j = 0; j < n; j++)
00046 {
00047 x[i*n+j]=0.0;
00048 printf("%Lf\n",x[i*n+j]);
00049 }
00050 }
00051
00052
00053 f=(double *)malloc(sizeof(double) * m);
00054 for (i = 0; i < 28; i++)
00055 {
00056 func_num=i+1;
00057 for (k = 0; k < 1; k++)
00058 {
00059 test_func(x, f, n,m,func_num);
00060 for (j = 0; j < m; j++)
00061 printf(" f%d(x[%d]) = %Lf,",func_num,j+1,f[j]);
00062 printf("\n");
00063 }
00064 }
00065 free(x);
00066 free(f);
00067 free(y);
00068 free(z);
00069 free(M);
00070 free(OShift);
00071 free(x_bound);
00072 }
00073
00074