/src/main/java/net/finmath/functions/LinearAlgebra.java
for ( int rows = 0; factor < numberOfFactors; factor++) {
for ( int factor = 0; factor < numberOfFactors; factor++ ) {
return factorMatrix; } public static double[][] factorReductionUsingCommonsMath(final double[][] correlationMatrix, final int numberOfFactors) { final double[][] factorMatrix = getFactorMatrix(correlationMatrix, numberOfFactors); for (int row = 0; row < correlationMatrix.length; row++) { double sumSquared = 0; <extra_id_0> sumSquared += factorMatrix[row][factor] * factorMatrix[row][factor]; } if(sumSquared != 0) { for (int factor = 0; factor < numberOfFactors; factor++) { factorMatrix[row][factor] = factorMatrix[row][factor] / Math.sqrt(sumSquared); }