May 6, 2013 at 12:21am UTC
int main (int argc, char **argv)
{
// int i,m;
double v1[kmax],v2[kmax],Ng,Lk[kmax],Hmax,Lmk[N],FD;
//double Lk1 = 0.0;
double x1[N];
loadImage("../sierpinski10.pgm");
printf("Bnorm[40][2] = %f",Bnorm[40][2]); //test
// Lmk[0] = 0.0; Lk=0.0;
double sum = 0.0;
for(int i=0;i<N;i++){
sum = 0.0;
for(int j=0;j<N;j++){
sum+=Bnorm[i][j];
}
x1[i]=sum;
}
//for(m=1;m<=N;m++){
for(int k=0;k<kmax;k++)
{
Lk[k]=0.0;
for(int i=0;i<N;i++){
Lmk[i] =0.0;
Hmax = (N-i)/(double)k;
Ng = (N-1)/(Hmax*k);
for(i=0;i<=N;i++)
{
Lmk[i] = Lmk[i]+ abs(x1[i+1]-x1[i]*Ng);
}
Lk[k] = Lk[k] + Lmk[i]/(double)k;
}
Lk[k]=Lk[k]/(double)k;
}
for(int k=0;k<kmax;k++)
{
v1[k] = log((double)k);
v2[k] = log(Lk[k]);
}
FD =lreg(kmax,v1,v2);
fprintf(fout,"%f\n",FD);
return(0);
}
Note:Can somebody please help me to check this code;I am receiving error "Run-Time Check Failure #2 - Stack around the variable 'Lmk' was corrupted."
May 6, 2013 at 3:02am UTC
Your code does not compile.
Also, use code tags when posting
May 6, 2013 at 4:15am UTC
Yes I am sorry, I only copied the main code. And secondly there is an image on my desktop tha6t has to be loaded. kunleuc