Beispiel #1
0
 void appendIfAbsent(ActiveList al) {
   if (_n + al._n > _a.length) growTo(2 * (_n + al._n));
   int n = al._n;
   for (int i = 0; i < n; ++i) {
     Sample s = al.get(i);
     if (s.absent) {
       _a[_n++] = s;
       s.absent = false;
     }
   }
 }
Beispiel #2
0
 /*
  * Solves for times by sequentially processing each sample in active list.
  */
 private void solveSerial(
     ActiveList al, float[][][] t, int m, float[][][] times, int[][][] marks) {
   float[] d = new float[6];
   ActiveList bl = new ActiveList();
   int ntotal = 0;
   while (!al.isEmpty()) {
     // al.shuffle(); // demonstrate that solution depends on order
     int n = al.size();
     ntotal += n;
     for (int i = 0; i < n; ++i) {
       Sample s = al.get(i);
       solveOne(t, m, times, marks, s, bl, d);
     }
     bl.setAllAbsent();
     al.clear();
     al.appendIfAbsent(bl);
     bl.clear();
   }
   trace("solveSerial: ntotal=" + ntotal);
   trace("             nratio=" + (float) ntotal / (float) (_n1 * _n2 * _n3));
 }