Computes the mean or average of all the elements.

@return mean
767739
public double mean() {
        double total = 0;

        final int N = getNumElements();
        for( int i = 0; i < N; i++ ) {
            total += get(i);
        }

        return total/N;
    }
277743
public function AggregateExpression()
    {
        $lookaheadType = $this->lexer->lookahead['type'];
        $isDistinct    = false;

        if (! in_array($lookaheadType, [Lexer::T_COUNT, Lexer::T_AVG, Lexer::T_MAX, Lexer::T_MIN, Lexer::T_SUM], true)) {
            $this->syntaxError('One of: MAX, MIN, AVG, SUM, COUNT');
        }

        $this->match($lookaheadType);
        $functionName = $this->lexer->token['value'];
        $this->match(Lexer::T_OPEN_PARENTHESIS);

        if ($this->lexer->isNextToken(Lexer::T_DISTINCT)) {
            $this->match(Lexer::T_DISTINCT);
            $isDistinct = true;
        }

        $pathExp = $this->SimpleArithmeticExpression();

        $this->match(Lexer::T_CLOSE_PARENTHESIS);

        return new AST\AggregateExpression($functionName, $pathExp, $isDistinct);
    }
1038909
public static /*@pure@*/ double mean(double[] vector) {
  
    double sum = 0;

    if (vector.length == 0) {
      return 0;
    }
    for (int i = 0; i < vector.length; i++) {
      sum += vector[i];
    }
    return sum / (double) vector.length;
  }
335541
def mean
      mean = Pair.new(0, 0)
      weight = 0

      objects.each do |object, n|
        (1..n).each do |_i|
          mean + object
          weight += 1
        end
      end
      mean / weight
      mean
    end
215923
def mean(self):
    """"""
    if len(self) == 0:
      return float('NaN')
    arr = self.samples()
    return sum(arr) / float(len(arr))
193160
public static double StdDev( int[] values, double mean ){
        double  stddev = 0;
        double  diff;
        int     hits;
        int     total = 0;

        // for all values
        for ( int i = 0, n = values.length; i < n; i++ )
        {
            hits = values[i];
            diff = (double) i - mean;
            // accumulate std.dev.
            stddev += diff * diff * hits;
            // accumalate total
            total += hits;
        }

        return ( total == 0 ) ? 0 : Math.sqrt( stddev / (total - 1) );
    }
169907
public function median(): float
    {
        $a = $this->a;
        $b = $this->b;

        return ($a + $b) / 2;
    }
1264325
def mean(self):
        

        return np.dot(np.array(self.norm_scores), self.weights)
1244694
public function min(){
		
		if($this->isEmpty()){
			throw new \UnderflowException(\get_called_class() . ' is empty');
		}
		
		$min = $this->front();
		
		for($i = 1, $l = $this->count(); $i < $l; ++$i){
			if(Number::lessThan($this->_Arr[$i], $min)){
				$min = $this->_Arr[$i];
			}
		}
		
		return $min;
		
	}
622652
public byte meanValue() {
        if (data.length == 0)
            return 0;

        int sum = 0;
        for (byte b : data)
            sum += b;
        return (byte) (sum / data.length);
    }
876930
public static double mean(Collection<? extends Number> values) {
        double sum = 0d;
        for (Number n : values)
            sum += n.doubleValue();
        return sum / values.size();
    }
579504
public function size()
    {
        $countArray = array_map(function ($item) { return count($item); }, $this->identityMap);

        return array_sum($countArray);
    }
146183
public Double getVariance() {
		if (counter == 0) {
			return Double.NaN;
		} else {
			final double mean = computeMean();
			final double meanSquare = mean * mean;
			final double squareMean = ((double) squareTotal) / counter;
			return squareMean - meanSquare;
		}
	}
1225231
public double stdev() {
        double m = mean();

        double total = 0;

        final int N = getNumElements();
        if( N <= 1 )
            throw new IllegalArgumentException("There must be more than one element to compute stdev");


        for( int i = 0; i < N; i++ ) {
            double x = get(i);

            total += (x - m)*(x - m);
        }

        total /= (N-1);

        return Math.sqrt(total);
    }
22547
public static double mean( InterleavedU8 img ) {
		return sum(img)/(double)(img.width*img.height*img.numBands);
	}
1206380
public NumberExpression<Double> avg() {
        if (avg == null) {
            avg = Expressions.numberOperation(Double.class, Ops.AggOps.AVG_AGG, mixin);
        }
        return avg;
    }
65821
public function median($key = null): ?float
    {
        $count = 0;
        $set = [];

        foreach ($this->generator as $givenKey => $item) {
            if ($key) {
                $item = $this->accessKey($item, $key, $givenKey);
            }

            $set[] = $item;
            $count++;
        }

        // Handle empty list
        if ($count === 0) {
            return null;
        }

        // Sort the full set
        sort($set);

        // If the count is divisible by 2, we'll need to get the average of the two
        if ($count && !($count % 2)) {
            $id = floor($count / 2) - 1;
            return ($set[(string)$id] + $set[(string)($id + 1)]) / 2;
        }

        return $set[$count / 2];
    }