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 |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
|
// Jacobi iteration on a mesh. Based loosely on a Filaments demo |
15 |
|
/** |
16 |
|
* The maximum number of matrix cells |
17 |
|
* at which to stop recursing down and instead directly update. |
18 |
< |
**/ |
19 |
< |
|
18 |
> |
*/ |
19 |
|
static final double EPSILON = 0.0001; // convergence criterion |
20 |
|
|
21 |
|
public static void main(String[] args) throws Exception { |
92 |
|
reinitialize(); |
93 |
|
} |
94 |
|
double m = maxDiff; |
95 |
< |
return (md > m)? md : m; |
95 |
> |
return (md > m) ? md : m; |
96 |
|
} |
97 |
|
|
98 |
|
} |
118 |
|
|
119 |
|
public void compute() { |
120 |
|
boolean AtoB = (steps++ & 1) == 0; |
121 |
< |
double[][] a = (AtoB)? A : B; |
122 |
< |
double[][] b = (AtoB)? B : A; |
121 |
> |
double[][] a = AtoB ? A : B; |
122 |
> |
double[][] b = AtoB ? B : A; |
123 |
|
|
124 |
|
double md = 0.0; // local for computing max diff |
125 |
|
|