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; } }
private void totalIterateOS(Matrix3DImpl data) { double[][][] matrix = data.getData(); Matrix2DImpl totalsOS = (Matrix2DImpl) os.getControlConstants(); for (int o = 0; o < dimensions[1]; o++) for (int s = 0; s < dimensions[2]; s++) { double totalOS = totalsOS.getElement(o, s); double totalF = 0; for (int f = 0; f < dimensions[0]; f++) totalF += matrix[f][o][s]; if (!(totalF == 0 && totalOS == 0)) if (totalF == 0) for (int f = 0; f < dimensions[0]; f++) matrix[f][o][s] = totalOS / dimensions[0]; else for (int f = 0; f < dimensions[0]; f++) matrix[f][o][s] = (matrix[f][o][s] / totalF) * totalOS; } }
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; } }