报错板之相关问题,谢谢!!
error: stray '\246' in program|error: stray '\302' in program|
请问一下,报错板出现这个是哪里出错了呢(翻译我查了,但是我还是不懂) 不发代码就想让别人帮你?做梦 {:10_245:}
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define N 200
#define P 4
int MatrixInvSymmetric(double *a,int n)//求逆
{
int i,j,k,m;
double w,g,*b;
b = (double*)malloc(n*sizeof(double));
for (k=0; k<n; k++)
{
w=a;
if (fabs(w)<1.0e-8)
{
free(b);
return(-2);
}
m=n-k-1;
for (i=1; i<n; i++)
{
g=a;
b=g/w;
if (i<=m)
b=-b;
for (j=1; j<=i; j++)
a[(i-1)*n+j-1]=a+g*b;
}
a=1.0/w;
for (i=1; i<n; i++)
a[(n-1)*n+i-1]=b;
}
for (i=0; i<n-1; i++)
for (j=i+1; j<n; j++)
a=a;
free(b);
return(2);
}
void readBinaryFile(char *filenames, double *arr, int n)
{
//数据的读取
FILE *fp;
if((fp=fopen(filenames,"rb"))==NULL)
{
printf("cannot open file!\n");
exit(0);
}
fread(arr,sizeof(double),n,fp);
fclose(fp);
}
void EstimateBeta(double *β,double *Y,double *X)
{
double M= {0},Q= {0};
int i,j,k;
for(i=0; i<N; i++)
{
for(j=0; j<N; j++)
{
for(k=0; k<N; k++)
{
M+=X*X;
}
}
}
MatrixInvSymmetric(M,N);
for(i=0; i<P; i++)
{
for(j=0; j<N; j++)
{
Q+=X*Y;
}
}
for(i=0; i<P; i++)
{
for(j=0; j<P; j++)
{
β+=M*Q;
}
}
}
int main()
{
double Y, X,β= {0};
readBinaryFile("yb.dat",Y,N);
readBinaryFile("xb.dat",X,N*P);
EstimateBeta(β,Y,X);
return 0;
}
啊,我懂啦,谢谢大家
页:
[1]