It was thus said that the Great Jonathan Katz once stated:
I have an IRIS Indigo R3000, but one of the hard
drives is dying. It's IRIX
4.0.5 with all the compliers. I can boot it up if necessary.
If you don't mind. I would like to know the speed, since the original
code was run at 33MHz. I need the code below compiled (at the highest
optimization setting) and run. I would like the output from time
% time a.out >output
as well as the output from the program (so I can check it). Warning: The
program will take some time to run, but hopefully, it'll finish in less than
10 hours [1]. (Also, if possible, if you could change MAX to 5000 [2] and
run it a second time that would also be appreciated).
-spc (Thank you very much if you can do this)
[1] This is just a fraction of the original program that generates a
single image. The full program calculated some 500 images and thus,
took around a year to run.
[2] The original MAX was 5000.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX 32768
#define DIM 500
int mainloop(const double,const double,const double,const double);
int main(void)
{
double A;
double B;
for (B = 4.0 ; B >= -4.0 ; B -= 0.016)
for (A = -4.0 ; A <= 4.0 ; A += 0.016)
printf("%d\n",mainloop(A,B,4.0,4.0));
return(0);
}
unsigned int serial;
unsigned int pix[DIM][DIM];
int mainloop(const double A,const double B,const double C,const double D)
{
double xn,xn1;
double yn,yn1;
int ix;
int iy;
int count;
serial++;
for (count = 0 , xn = yn = 0.5 ; count < MAX; count++)
{
xn1 = ((A * yn) + B) * xn * (1.0 - xn);
yn1 = ((C * xn) + D) * yn * (1.0 - yn);
xn = xn1;
yn = yn1;
if (xn == HUGE_VAL) return MAX-1;
if (xn == -HUGE_VAL) return MAX-1;
if (yn == HUGE_VAL) return MAX-1;
if (yn == -HUGE_VAL) return MAX-1;
if (xn < 0.0) continue;
if (xn >= 1.0) continue;
if (yn < 0.0) continue;
if (yn >= 1.0) continue;
ix = (int)(xn * DIM);
iy = (int)(yn * DIM);
if (pix[ix][iy] == serial)
break;
pix[ix][iy] = serial;
}
return(count-1);
}