ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/ThreadPhaserJacobi.java
(Generate patch)

Comparing jsr166/src/test/loops/ThreadPhaserJacobi.java (file contents):
Revision 1.2 by jsr166, Thu Oct 29 23:09:08 2009 UTC vs.
Revision 1.7 by jsr166, Sat Oct 16 16:22:57 2010 UTC

# Line 1 | Line 1
1 + /*
2 + * Written by Doug Lea with assistance from members of JCP JSR-166
3 + * Expert Group and released to the public domain, as explained at
4 + * http://creativecommons.org/licenses/publicdomain
5 + */
6 +
7   // Barrier version of Jacobi iteration
8  
9   import java.util.*;
# Line 11 | Line 17 | public class ThreadPhaserJacobi {
17      /**
18       * The maximum submatrix length (both row-wise and column-wise)
19       * for any Segment
20 <     **/
15 <
20 >     */
21      static final double EPSILON = 0.0001;  // convergence criterion
22  
23      static int dimGran;
# Line 33 | Line 38 | public class ThreadPhaserJacobi {
38          }
39  
40          int granularity = n * n / nprocs;
41 <        dimGran = (int)(Math.sqrt(granularity));
41 >        dimGran = (int) Math.sqrt(granularity);
42  
43          // allocate enough space for edges
44          int dim = n+2;
# Line 61 | Line 66 | public class ThreadPhaserJacobi {
66              driver.compute();
67  
68              long time = System.currentTimeMillis() - startTime;
69 <            double secs = ((double)time) / 1000.0;
69 >            double secs = (double) time / 1000.0;
70  
71              System.out.println("Compute Time: " + secs);
72          }
# Line 107 | Line 112 | public class ThreadPhaserJacobi {
112                      double[][] tmp = a; a = b; b = tmp;
113                  }
114              }
115 <            catch(Exception ex) {
115 >            catch (Exception ex) {
116                  ex.printStackTrace();
117                  return;
118              }
# Line 157 | Line 162 | public class ThreadPhaserJacobi {
162  
163              int rows = hiRow - loRow + 1;
164              int cols = hiCol - loCol + 1;
165 <            int rblocks = (int)(Math.round((float)rows / dimGran));
166 <            int cblocks = (int)(Math.round((float)cols / dimGran));
165 >            int rblocks = Math.round((float) rows / dimGran);
166 >            int cblocks = Math.round((float) cols / dimGran);
167  
168              int n = rblocks * cblocks;
169  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines