*/
public static void doubleTest24(int runs, int size, boolean dense) {
System.out.println("\n\n");
System.out.println("initializing...");
DoubleMatrix2D A;
DoubleFactory2D factory;
if (dense)
factory = Factory2D.dense;
else
factory = Factory2D.sparse;
double value = 2;
double omega = 1.25;
final double alpha = omega * 0.25;
final double beta = 1-omega;
A = factory.make(size,size,value);
cern.colt.function.Double9Function function = new cern.colt.function.Double9Function() {
public final double apply(double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22) {
return alpha*a11 + beta*(a01+a10+a12+a21);
}
};
cern.colt.Timer timer = new cern.colt.Timer().start();
System.out.println("benchmarking stencil...");
for (int i=0; i<runs; i++) {
A.zAssign8Neighbors(A,function);
}
//A.zSum4Neighbors(A,alpha,beta,runs);
timer.stop().display();
//System.out.println("A="+A);
A=null;
double[][] B = factory.make(size,size,value).toArray();
timer.reset().start();
System.out.println("benchmarking stencil scimark...");
for (int i=0; i<runs; i++) {
// jnt.scimark2.SOR.execute(omega, B, runs);