|
楼主 |
发表于 2003-8-6 06:21:02
|
显示全部楼层
#incldue<math.h>
float t; /*the whole variable*/
main()
{int n,k=1;
float cr,matrix_a[11][11],mat_w[11]; /*The dimension of*/
float insert(float matrix_b[][],int p1); /*a feasible matrix<11*/
float samplify(float matrix_c[][],float mat_w1[],int p2)
folat judge(matrix_d[][],mat_w2[],int p3)
while(k)
{ printf("The matrix's dimension n=");
scanf("%d",&n);
if(n>11||n<=1)
prinf("The matrix is unfeasible\n");
else
printf("please Input the matrix\n");
insert(matrix_a,n);
samplify(matrix_a,mat_w,n);
cr=judge(matrix_a,mat_w,n);
if(cr<0.1)
{ k=0;
printf("The matrix have passed inspection\n");
}
}
for(i=0;i<n;i++)
for(j=0;j<n;j++)
printf("The matrix:%f\n",matrix_a[j]);
printf("\n");
for(i=0;i<n;i++)
printf("w=%-10.5f",mat_w);
printf("%-10.6f",t);
}
void insert(float matrix_b[][],int n)
{ int i,j,n=3;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%f",&matrix_b[j]
}
void samplify(float matrix_c[][],float mat_w1[],int n)
{int i,j;
float matrix_p[11][11],
float sum_1[11]={0.0,0........},sum_2[11]={0.0.....},sum_3=0.0;
for(i=0;i<n;i++)
for(j=0,j<n;j++)
{ sum_1=matrix_c[j]+sum_1;
matrix_p[j]= matrix_c[j]/sum_1; /*this is row's samplify*/
}
for(i=0;i<n;i++)
for(j=0;j<n;j++)
sum_2=matrix_p[j]+sum_2;
for(i=0;i<n;i++)
sum_3=sum_2+sum_3;
for(i=0;j<nj++)
mat_w1=sum_2/sum_3;
return;
}
void judge(float matrix_d[][],float mat_w2[],int n)
{int i,j;
float mat_ri[]={0,0,0,0.58,0.90,1.12,1.24,1.32,1.41,1.45,1.49,1.51};
float ci,cr,sum_4=0.0,matrix_p[11]={0.0.........};
for(i=0;i<n;i++)
for(j=0;j<n;j++)
matrix_p=matrix_d[j]*mat_w1[j]+matrix_p;
for(i=0;i<n;i++)
sum_4=matrix_p/mat_w2+sum_4;
t=sum_4/n;
ci=(t-n)/(n-1);
cr=ci/ri[n];
return(cr);
}
|
|