Returns the median of three elements.
160651
private int trMedian3(int ISAd, int v1, int v2, int v3) {
        if (SA[ISAd + SA[v1]] > SA[ISAd + SA[v2]]) {
            int t = v1;
            v1 = v2;
            v2 = t;
        }
        if (SA[ISAd + SA[v2]] > SA[ISAd + SA[v3]]) {
            if (SA[ISAd + SA[v1]] > SA[ISAd + SA[v3]]) {
                return v1;
            } else {
                return v3;
            }
        }
        return v2;
    }
213161
def median(self, name, **kwargs):
        
        data = self.get(name,**kwargs)
        return np.percentile(data,[50])
954425
public static <T> Collector<T, ?, Optional<T>> median(Comparator<? super T> comparator) {
        return percentile(0.5, comparator);
    }
616296
def median_grouped(name, num, minimum=0, maximum=0, ref=None):
    '''
    
    '''
    return calc(
        name=name,
        num=num,
        oper='median_grouped',
        minimum=minimum,
        maximum=maximum,
        ref=ref
    )
367867
public double median(double[] series) {
    double[] clonedSeries = series.clone();
    Arrays.sort(clonedSeries);

    double median;
    if (clonedSeries.length % 2 == 0) {
      median = (clonedSeries[clonedSeries.length / 2]
          + (double) clonedSeries[clonedSeries.length / 2 - 1]) / 2;
    }
    else {
      median = clonedSeries[clonedSeries.length / 2];
    }
    return median;
  }
357272
def compute_balance_median_ts(self, ts):
        
        balance = [self.compute_balance_median(ts, t) for t in np.arange(0, len(ts) - 1)]
        return balance
217699
private int choose_pivot(int p, int n) {
        int pl, pm, pn;// pointers
        int s;

        pm = p + (n >> 1); /* small arrays, middle element. */
        if (n > 7) {
            pl = p;
            pn = p + n - 1;
            if (n > 40) { /* big arrays, pseudomedian of 9. */
                s = n >> 3;
                pl = MED3(pl, pl + s, pl + s + s);
                pm = MED3(pm - s, pm, pm + s);
                pn = MED3(pn - s - s, pn - s, pn);
            }
            pm = MED3(pl, pm, pn); /* midsize arrays, median of 3. */
        }
        return KEY(pm);
    }
1156190
public static <T extends Comparable<? super T>> T median(final T[] a) {
        N.checkArgNotNullOrEmpty(a, "The spcified array 'a' can not be null or empty");

        return median(a, 0, a.length);
    }
185454
def centroid(data, method=median):
    ""
    out = []
    for i in range(len(data[0])):
        out.append(method([x[i] for x in data]))
    return tuple(out)
823900
function trimean( arr, opts ) {
	if ( !Array.isArray( arr ) ) {
		throw new TypeError( 'trimean()::invalid input argument. Must provide an array.' );
	}
	if ( arguments.length > 1 ) {
		if ( !isObject( opts ) ) {
			throw new TypeError( 'trimean()::invalid input argument. Options should be an object.' );
		}
	} else {
		opts = {
			'sorted': false
		};
	}
	if ( !opts.sorted ) {
		arr = arr.slice();
		arr.sort( ascending );
		opts.sorted = true;
	}
	var q1 = quantile( arr, 0.25, opts ),
		q2 = median( arr, true ),
		q3 = quantile( arr, 0.75, opts );

	return ( q1 + 2*q2 + q3 ) / 4.0;
}
250833
def _extract_median(image, mask = slice(None), size = 1, voxelspacing = None):
    
    # set voxel spacing
    if voxelspacing is None:
        voxelspacing = [1.] * image.ndim
        
    # determine structure element size in voxel units
    size = _create_structure_array(size, voxelspacing)
        
    return _extract_intensities(median_filter(image, size), mask)
1356610
public static <T> T median(final T a, final T b, final T c, Comparator<? super T> cmp) {
        cmp = cmp == null ? NATURAL_ORDER : cmp;

        int ab = cmp.compare(a, b);
        int ac = cmp.compare(a, c);
        int bc = 0;

        if ((ab >= 0 && ac <= 0) || (ac >= 0 && ab <= 0)) {
            return a;
        } else if ((((bc = cmp.compare(b, c)) <= 0) && ab <= 0) || (bc >= 0 && ab >= 0)) {
            return b;
        } else {
            return c;
        }
    }
203517
def median_interval(data, alpha=_alpha):
    
    q = [100*alpha/2., 50, 100*(1-alpha/2.)]
    lo,med,hi = np.percentile(data,q)
    return interval(med,lo,hi)
336233
public static <T, U extends Comparable<? super U>> Collector<T, ?, Optional<U>> median(Function<? super T, ? extends U> function) {
        return percentile(0.5, function);
    }
1203130
def middle(self):
        
        return (self.min_x + self.max_x) / 2, (self.min_y + self.max_y) / 2
84470
public static char median(final char a, final char b, final char c) {
        if ((a >= b && a <= c) || (a >= c && a <= b)) {
            return a;
        } else if ((b >= a && b <= c) || (b >= c && b <= a)) {
            return b;
        } else {
            return c;
        }
    }
207781
def median(values):
    
    values.sort()
    n = int(len(values) / 2)
    return values[n]