task t1(StartupObject s{initialstate}) {
//System.printString("task t1\n");
- int N_sim=1200;
+ int N_sim=1200 * 6;
int N_samp=8;
- int N_ch=16;
- int N_col=128;
+ int N_ch=62 * 2; //16;
+ int N_col=128 * 6;
int i,j;
for(j = 0; j < N_ch; j++) {
task t1(StartupObject s{initialstate}) {
//System.printString("task t1\n");
- int width = 160;
- int height = 160;
- int group = 16;
+ int width = 62 * 15 * 2;
+ int height = 62 * 16;
+ int group = 62 * 2;
- int h = height / group;
+ //int h = height / group;
+ //Random rnd = new Random();
+ //int maxint = (~0x1) + 1;
+ int red = 255; //(int)(((float)rnd.nextInt()/maxint)*255);
+ int green = 237; //(int)(((float)rnd.nextInt()/maxint)*255);
+ int blue = 100; //(int)(((float)rnd.nextInt()/maxint)*255);
for(int i = 0; i < group; i++) {
Fractal fratal = new Fractal(i,
group,
width,
- height){run};
+ height,
+ red,
+ green,
+ blue){run};
}
Image image = new Image(group){!finish};
public Fractal(int index,
int group,
int width,
- int height) {
+ int height,
+ int red,
+ int green,
+ int blue) {
this.id = index;
this.group = group;
this.AppletWidth = width;
this.alen = (float)3.0;//this.amax - this.amin;
this.blen = (float)3.0;//this.bmax - this.bmin;
this.alpha = 0xff;
- this.red = 0xff;
- this.green = 0xff;
- this.blue = 0xff;
+ this.red = red;
+ this.green = green;
+ this.blue = blue;
this.times = 255;
int length = this.AppletWidth * this.AppletHeight / this.group;
this.pixels = new int[length];
while (incr < length) {
ps[incr++] = this.alpha<<24 | 0x00<<16 | 0x00<<8 | 0xff;
}
- Random rnd = new Random();
- int maxint = (1<<32) - 1;
- red = (int)(((float)rnd.nextInt()/maxint)*255);
- green = (int)(((float)rnd.nextInt()/maxint)*255);
- blue = (int)(((float)rnd.nextInt()/maxint)*255);
}
public void run () {
if(iteration<=times & iteration>0) {
scaleda=(int)((a - amin)*appletWidth/(amax - amin));
scaledb=(int)((b - bmin)*appletHeight/(bmax - bmin));
- int index = (scaledb * appletWidth + scaleda - id) / group;
- if(index < length) {
+ int index = ((scaledb - id) / group) * appletWidth + scaleda; //(scaledb * appletWidth + scaleda - id) / group;
+ //if(index < length) {
ps[index] = alpha<<24 | red<<16 | iteration<<8 | blue;
- }
+ //}
}
}
}
//System.printString("task t1\n");
int datasize = 1000; //should be times of 2
- int nruns = 16 * 16;
- int group = 16;
+ int nruns = 62 * 7 * 2; //16 * 16;
+ int group = 62 * 2; // 16;
AppDemo ad = new AppDemo(datasize, nruns, group){merge};
* </ol>
*
* @author H W Yau
- * @version $Revision: 1.2 $ $Date: 2009/02/13 21:37:19 $
+ * @version $Revision: 1.3 $ $Date: 2009/07/02 23:35:24 $
*/
public class RatePath extends PathId {
// Now create an array to store the rates data.
int minimumdate = MINIMUMDATE;
float epsilon = EPSILON;
- int nLines = 200;
+ int nLines = 1000; //200;
int year = 88;
int month = 10;
int day = 3;
/*for(int di = 0; di < 9; di++) {
aDate = aDate * 10 + (int)date[di];
}*/
- for(int k = 0; k < 40; k++ ) {
- for(int j = 0; j < 5; j++) {
+ for(int k = 0; k < 20; /*40;*/ k++ ) {
+ for(int j = 0; j < 50; /*5;*/ j++) {
/*String date = "19"+String.valueOf(year);
if(month < 10) {
date += "0";
task t1(StartupObject s{initialstate}) {
//System.printString("task t1\n");
- int datasize = 16;
- for(int i = 0; i < datasize; ++i) {
- SeriesRunner sr = new SeriesRunner(i){!finish};
+ int datasize = 62 * 2000;
+ int threadnum = 62;
+ int range = datasize / threadnum;
+ for(int i = 0; i < threadnum; ++i) {
+ SeriesRunner sr = new SeriesRunner(i, range){!finish};
}
-
+
taskexit(s{!initialstate});
}
flag finish;
int id;
+ int range;
- public SeriesRunner(int id){
+ public SeriesRunner(int id, int range){
this.id=id;
+ this.range = range;
}
public void run() {
- float pair[] = new float[2];
+ float pair[][] = new float[2][range];
// Calculate the fourier series. Begin by calculating A[0].
if (id==0) {
- pair[0] = TrapezoidIntegrate((float)0.0, //Lower bound.
+ pair[0][0] = TrapezoidIntegrate((float)0.0, //Lower bound.
(float)2.0, // Upper bound.
1000, // # of steps.
(float)0.0, // No omega*n needed.
0) / (float)2.0; // 0 = term A[0].
- pair[1] = 0;
- } else {
- // Calculate the fundamental frequency.
- // ( 2 * pi ) / period...and since the period
- // is 2, omega is simply pi.
- float omega = (float) 3.1415926535897932; // Fundamental frequency.
-
+ pair[1][0] = 0;
+ }
+ // Calculate the fundamental frequency.
+ // ( 2 * pi ) / period...and since the period
+ // is 2, omega is simply pi.
+ float omega = (float) 3.1415926535897932; // Fundamental frequency.
+
+ int ilow = id*range;
+ if(id==0) ilow += 1;
+ int iupper = (id+1)*range;
+ for(int i = ilow; i < iupper; i++) {
+ int j = i-id*range;
// Calculate A[i] terms. Note, once again, that we
// can ignore the 2/period term outside the integral
// since the period is 2 and the term cancels itself
// out.
- pair[0] = TrapezoidIntegrate((float)0.0,
+ pair[0][j] = TrapezoidIntegrate((float)0.0,
(float)2.0,
1000,
- omega * (float)id,
+ omega * (float)i,
1); // 1 = cosine term.
// Calculate the B[i] terms.
- pair[1] = TrapezoidIntegrate((float)0.0,
+ pair[1][j] = TrapezoidIntegrate((float)0.0,
(float)2.0,
1000,
- omega * (float)id,
+ omega * (float)i,
2); // 2 = sine term.
}
// validate
- if(id < 4) {
+ if(id == 0) {
float ref[][] = new float[4][2];
ref[0][0] = (float)2.87290112;
ref[0][1] = (float)0.0;
ref[2][1] = (float)-1.16458096;
ref[3][0] = (float)0.15222694;
ref[3][1] = (float)-0.81435320;
- for (int j = 0; j < 2; j++){
- float error = Math.abs(pair[j] - ref[id][j]);
- if (error > 1.0e-7 ){
- //System.printI(0xa7);
- //System.printString("Validation failed for coefficient " + j + "," + id + "\n");
- //System.printString("Computed value = " + (int)(pair[j]*100000000) + "\n");
- //System.printString("Reference value = " + (int)(ref[id][j]*100000000) + "\n");
- //System.printI((int)(pair[j]*10000));
- //System.printI((int)(ref[id][j]*10000));
+ for(int i = 0; i < 4; i++) {
+ for (int j = 0; j < 2; j++){
+ float error = Math.abs(pair[j][i] - ref[i][j]);
+ if (error > 1.0e-7 ){
+ //System.printI(0xa7);
+ //System.printString("Validation failed for coefficient " + j + "," + id + "\n");
+ //System.printString("Computed value = " + (int)(pair[j]*100000000) + "\n");
+ //System.printString("Reference value = " + (int)(ref[id][j]*100000000) + "\n");
+ //System.printI((int)(pair[j]*10000));
+ //System.printI((int)(ref[id][j]*10000));
+ }
+ }
}
- }
- }
}
+ }
/*
* TrapezoidIntegrate
--- /dev/null
+JGFSeries:
+ Single:
+ task t1(StartupObject s{initialstate}) {
+ //System.printString("task t1\n");
+
+ int datasize = 62*2000;
+ int threadnum = 62;
+ ...
+ }
+
+ Double:
+ task t1(StartupObject s{initialstate}) {
+ //System.printString("task t1\n");
+
+ int datasize = 62*2000 *2;
+ int threadnum = 62 * 2;
+ ...
+ }
+
+
+FilterBank:
+ Single:
+ task t1(StartupObject s{initialstate}) {
+ //System.printString("task t1\n");
+
+ int N_sim=1200 * 6;
+ int N_samp=8;
+ int N_ch=62;
+ int N_col=128 * 6;
+ ...
+ }
+
+
+ Double:
+ task t1(StartupObject s{initialstate}) {
+ //System.printString("task t1\n");
+
+ int N_sim=1200 * 6;
+ int N_samp=8;
+ int N_ch=62 * 2;
+ int N_col=128 * 6;
+ ...
+ }
+
+
+Fractal:
+ Single:
+ task t1(StartupObject s{initialstate}) {
+ //System.printString("task t1\n");
+
+ int width = 62 * 15;
+ int height = 62 * 17;
+ int group = 62;
+ ...
+ }
+
+ Double:
+ task t1(StartupObject s{initialstate}) {
+ //System.printString("task t1\n");
+
+ int width = 62 * 15 * 2;
+ int height = 62 * 17;
+ int group = 62 * 2;
+ ...
+ }
+
+
+JGFMonteCarlo:
+ Single:
+ task t1(StartupObject s{initialstate}) {
+ //System.printString("task t1\n");
+
+ int datasize = 1000; //should be times of 2
+ int nruns = 62 * 7 ;
+ int group = 62;
+ ...
+ }
+
+ in RatePath.java
+ private void readRatesFile(){
+ //
+ // Now create an array to store the rates data.
+ ...
+ int nLines = 1000;
+ ...
+ }
+
+ Double:
+ task t1(StartupObject s{initialstate}) {
+ //System.printString("task t1\n");
+
+ int datasize = 1000; //should be times of 2
+ int nruns = 62 * 14 ;
+ int group = 62 * 2;
+ ...
+ }
+
+ in RatePath.java
+ private void readRatesFile(){
+ //
+ // Now create an array to store the rates data.
+ ...
+ int nLines = 1000;
+ ...
+ }