M
Michael
Hi.
Here is my codes, which run too long. It takes about 8 minutes to complete
the "for" loop. Why does it run so long? What's wrong?
Thanks for any help.
Yours sincerely,
Michael
P.S.:
for(i=1; i<=30; i++)
{
mark:
for(j=1; j<=100; j++) x[j]=Random();//Random() will generate a value between
0 and 1;
if(check(x)==0) goto mark;
for(j=1; j<=100; j++) A[j]=x[j];
}
where check() is£º
static int check(double x[])
{
for(i = 1; i <= 100; i++)
if((x<0)||(x>C) return 0;
double sum = 0;
for(i = 1; i <= N; i++)
sum += array*x;
if(sum != 0) return 0;
return 1;
}
Here is my codes, which run too long. It takes about 8 minutes to complete
the "for" loop. Why does it run so long? What's wrong?
Thanks for any help.
Yours sincerely,
Michael
P.S.:
for(i=1; i<=30; i++)
{
mark:
for(j=1; j<=100; j++) x[j]=Random();//Random() will generate a value between
0 and 1;
if(check(x)==0) goto mark;
for(j=1; j<=100; j++) A[j]=x[j];
}
where check() is£º
static int check(double x[])
{
for(i = 1; i <= 100; i++)
if((x<0)||(x>C) return 0;
double sum = 0;
for(i = 1; i <= N; i++)
sum += array*x;
if(sum != 0) return 0;
return 1;
}