1 /** 2 @file 3 @ingroup nr 4 */ 5 #include <bpm/bpm_messages.h> 6 #include <bpm/bpm_nr.h> 7 8 /** 9 Find the median value of the given array. Basically a wrapper for nr_select 10 11 @return The value of the median element 12 */ nr_median(int n,double * arr)13double nr_median( int n, double *arr ) { 14 15 if( ! arr ) { 16 bpm_error( "Invalid array in nr_median(...)", 17 __FILE__, __LINE__ ); 18 return -DBL_MAX; 19 } 20 21 return nr_select( (int) (n / 2), n, arr ); 22 } 23 24