--- jsr166/src/test/loops/ThreadPhaserJacobi.java 2009/10/29 23:09:08 1.2 +++ jsr166/src/test/loops/ThreadPhaserJacobi.java 2010/10/16 16:22:57 1.7 @@ -1,3 +1,9 @@ +/* + * Written by Doug Lea with assistance from members of JCP JSR-166 + * Expert Group and released to the public domain, as explained at + * http://creativecommons.org/licenses/publicdomain + */ + // Barrier version of Jacobi iteration import java.util.*; @@ -11,8 +17,7 @@ public class ThreadPhaserJacobi { /** * The maximum submatrix length (both row-wise and column-wise) * for any Segment - **/ - + */ static final double EPSILON = 0.0001; // convergence criterion static int dimGran; @@ -33,7 +38,7 @@ public class ThreadPhaserJacobi { } int granularity = n * n / nprocs; - dimGran = (int)(Math.sqrt(granularity)); + dimGran = (int) Math.sqrt(granularity); // allocate enough space for edges int dim = n+2; @@ -61,7 +66,7 @@ public class ThreadPhaserJacobi { driver.compute(); long time = System.currentTimeMillis() - startTime; - double secs = ((double)time) / 1000.0; + double secs = (double) time / 1000.0; System.out.println("Compute Time: " + secs); } @@ -107,7 +112,7 @@ public class ThreadPhaserJacobi { double[][] tmp = a; a = b; b = tmp; } } - catch(Exception ex) { + catch (Exception ex) { ex.printStackTrace(); return; } @@ -157,8 +162,8 @@ public class ThreadPhaserJacobi { int rows = hiRow - loRow + 1; int cols = hiCol - loCol + 1; - int rblocks = (int)(Math.round((float)rows / dimGran)); - int cblocks = (int)(Math.round((float)cols / dimGran)); + int rblocks = Math.round((float) rows / dimGran); + int cblocks = Math.round((float) cols / dimGran); int n = rblocks * cblocks;