public static double elementMax ( DMatrixSparseCSC A ) { if ( A . nz_length == 0 ) return 0 ; // if every element is assigned a value then the first element can be a max. // Otherwise zero needs to be considered double max = A . isFull ( ) ? A . nz_values [ 0 ] : 0 ; for ( int i = 0 ; i < A . nz_length ; i ++ ) { double val = A . nz_values [ i ] ; if ( val > max ) { max = val ; } } return max ; }
Returns the value of the element with the largest value