7 |
|
//import jsr166y.*; |
8 |
|
import java.util.concurrent.*; |
9 |
|
|
10 |
– |
|
10 |
|
/** |
11 |
|
* LU matrix decomposition demo |
12 |
|
* Based on those in Cilk and Hood |
72 |
|
pool.shutdown(); |
73 |
|
} |
74 |
|
|
76 |
– |
|
75 |
|
static void randomInit(double[][] M, int n) { |
76 |
|
java.util.Random rng = new java.util.Random(); |
77 |
|
for (int i = 0; i < n; ++i) |
102 |
|
System.out.println("Max difference = " + maxDiff); |
103 |
|
} |
104 |
|
|
107 |
– |
|
105 |
|
// Blocks record underlying matrix, and offsets into current block |
106 |
|
static final class Block { |
107 |
|
final double[][] m; |
214 |
|
Block L10 = new Block(L.m, L.loRow+h, L.loCol); |
215 |
|
Block L11 = new Block(L.m, L.loRow+h, L.loCol+h); |
216 |
|
|
220 |
– |
|
217 |
|
Seq3 s1 = |
218 |
|
seq(new Lower(h, L00, M00), |
219 |
|
new Schur(h, L10, M00, M10), |
229 |
|
} |
230 |
|
} |
231 |
|
|
236 |
– |
|
232 |
|
static final class Upper extends RecursiveAction { |
233 |
|
final int size; |
234 |
|
final Block U; |
252 |
|
} |
253 |
|
} |
254 |
|
|
260 |
– |
|
255 |
|
public void compute() { |
256 |
|
if (size == BLOCK_SIZE) { |
257 |
|
upper(); |
284 |
|
} |
285 |
|
} |
286 |
|
|
293 |
– |
|
287 |
|
static final class LowerUpper extends RecursiveAction { |
288 |
|
final int size; |
289 |
|
final Block M; |