--- jsr166/src/test/loops/MatrixMultiply.java 2010/09/20 20:42:37 1.2 +++ jsr166/src/test/loops/MatrixMultiply.java 2014/12/31 16:44:01 1.7 @@ -1,18 +1,16 @@ /* * 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 + * http://creativecommons.org/publicdomain/zero/1.0/ */ //import jsr166y.*; import java.util.concurrent.*; -import java.util.concurrent.TimeUnit; /** * Divide and Conquer matrix multiply demo - **/ - + */ public class MatrixMultiply { /** for time conversion */ @@ -20,10 +18,11 @@ public class MatrixMultiply { static final int DEFAULT_GRANULARITY = 32; - /** The quadrant size at which to stop recursing down + /** + * The quadrant size at which to stop recursing down * and instead directly multiply the matrices. * Must be a power of two. Minimum value is 2. - **/ + */ static int granularity = DEFAULT_GRANULARITY; public static void main(String[] args) throws Exception { @@ -56,7 +55,7 @@ public class MatrixMultiply { return; } - ForkJoinPool pool = procs == 0? new ForkJoinPool() : + ForkJoinPool pool = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.println("procs: " + pool.getParallelism() + " n: " + n + " granularity: " + granularity + @@ -111,8 +110,6 @@ public class MatrixMultiply { * A21 | A22 B21 | B21 A21*B11 | A21*B21 A22*B21 | A22*B22 * */ - - static class Multiplier extends RecursiveAction { final float[][] A; // Matrix A final int aRow; // first row of current quadrant of A @@ -193,8 +190,7 @@ public class MatrixMultiply { * Note that the results are added into C, not just set into C. * This works well here because Java array elements * are created with all zero values. - **/ - + */ void multiplyStride2() { for (int j = 0; j < size; j+=2) { for (int i = 0; i < size; i +=2) {