public static double sumDoublematrixColumns ( int coolIndex , double [ ] [ ] matrixToSum , double [ ] [ ] resultMatrix , int firstRowIndex , int lastRowIndex , IHMProgressMonitor pm ) { double maximum ; maximum = 0 ; if ( matrixToSum . length != resultMatrix . length ) { pm . errorMessage ( msg . message ( "trentoP.error.matrix" ) ) ; //$NON-NLS-1$ throw new ArithmeticException ( msg . message ( "trentoP.error.matrix" ) ) ; //$NON-NLS-1$ } if ( firstRowIndex < 0 || lastRowIndex < firstRowIndex ) { pm . errorMessage ( msg . message ( "trentoP.error.nCol" ) ) ; //$NON-NLS-1$ throw new ArithmeticException ( msg . message ( "trentoP.error.nCol" ) ) ; //$NON-NLS-1$ } for ( int i = 0 ; i < matrixToSum . length ; ++ i ) { resultMatrix [ i ] [ coolIndex ] = 0 ; /* Initializes element */ for ( int j = firstRowIndex ; j <= lastRowIndex ; ++ j ) { resultMatrix [ i ] [ coolIndex ] += matrixToSum [ i ] [ j ] ; } if ( resultMatrix [ i ] [ coolIndex ] >= maximum ) /* Saves maximum value */ { maximum = resultMatrix [ i ] [ coolIndex ] ; } } return maximum ; }
Sum columns .