question: public static double computeMAD ( double [ ] x , double median ) { for ( int i = 0 ; i < x . length ; i ++ ) { x [ i ] = Math . abs ( x [ i ] - median ) ; } double mad = QuickSelect . median ( x ) ; if ( ! ( mad > 0. ) ) { double min = Double . POSITIVE_INFINITY ; for ( double xi : x ) { if ( xi > 0. && xi < min ) { min = xi ; } } if ( min < Double . POSITIVE_INFINITY ) { mad = min ; } else { mad = 1.0 ; } } return mad ; }
target:  Compute the median absolute deviation from median.