예제 #1
0
 public MatrixND<Double> run(double error) {
   MatrixND<Double> data = new MatrixNDImpl<Double>(dimensions, 1.0);
   while (!finish(error)) {
     os.iterate(data, 0);
     fs.iterate(data, 1);
     fo.iterate(data, new int[] {2});
     f.iterate(data, new int[] {1, 2});
   }
   return data;
 }
예제 #2
0
 private void maxIterateF(Matrix3DImpl data) {
   double[][][] matrix = data.getData();
   Matrix1DImpl maxsF = (Matrix1DImpl) f.getControlConstants();
   for (int f = 0; f < dimensions[0]; f++) {
     double maxF = maxsF.getElement(f);
     double totalOS = 0;
     for (int o = 0; o < dimensions[1]; o++)
       for (int s = 0; s < dimensions[2]; s++) totalOS += matrix[f][o][s];
     if (totalOS > maxF && !(totalOS == 0 && maxF == 0))
       for (int o = 0; o < dimensions[1]; o++)
         for (int s = 0; s < dimensions[2]; s++)
           matrix[f][o][s] = (matrix[f][o][s] / totalOS) * maxF;
   }
 }
예제 #3
0
 private void proportionIterateFO(Matrix3DImpl data) {
   double[][][] matrix = data.getData();
   Matrix2DImpl proportionsFO = (Matrix2DImpl) fo.getControlConstants();
   for (int f = 0; f < dimensions[0]; f++)
     for (int o = 0; o < dimensions[1]; o++) {
       double proportionFO = proportionsFO.getElement(f, o);
       double totalOS = 0;
       for (int o2 = 0; o2 < dimensions[1]; o2++)
         for (int s = 0; s < dimensions[2]; s++) totalOS += matrix[f][o2][s];
       double totalS = 0;
       for (int s = 0; s < dimensions[2]; s++) totalS += matrix[f][o][s];
       if (!(totalS == 0 && totalOS * proportionFO == 0))
         if (totalS == 0)
           for (int s = 0; s < dimensions[2]; s++)
             matrix[f][o][s] = totalOS * proportionFO / dimensions[2];
         else
           for (int s = 0; s < dimensions[2]; s++)
             matrix[f][o][s] = (matrix[f][o][s] / totalS) * totalOS * proportionFO;
     }
 }