code: public static DMatrixRMaj maxRows(DMatrixRMaj input , DMatrixRMaj output ) {
          if( output == null ) {
              output = new DMatrixRMaj(input.numRows,1);
          } else {
              output.reshape(input.numRows,1);
          }
  
          for( int row = 0; row < input.numRows; row++ ) {
              double max = -Double.MAX_VALUE;
  
              int end = (row+1)*input.numCols;
              for( int index = row*input.numCols; index < end; index++ ) {
                  double v = input.data[index];
                  if( v > max )
                      max = v;
              }
  
              output.set(row,max);
          }
          return output;
      }
docs: <p>
  Finds the element with the maximum value along each row in the input matrix and returns the results in a vector:<br>
  <br>
  b<sub>j</sub> = max(i=1:n ; a<sub>ji</sub>)
  </p>
  
  @param input Input matrix
  @param output Optional storage for output.  Reshaped into a column. Modified.
  @return Vector containing the sum of each row in the input.