## 5.6 Reductions

### 5.6.1 Log Sum of Exponents

real log_sum_exp(vector x)
The natural logarithm of the sum of the exponentials of the elements in x

real log_sum_exp(row_vector x)
The natural logarithm of the sum of the exponentials of the elements in x

real log_sum_exp(matrix x)
The natural logarithm of the sum of the exponentials of the elements in x

### 5.6.2 Minimum and Maximum

real min(vector x)
The minimum value in x, or $$+\infty$$ if x is empty

real min(row_vector x)
The minimum value in x, or $$+\infty$$ if x is empty

real min(matrix x)
The minimum value in x, or $$+\infty$$ if x is empty

real max(vector x)
The maximum value in x, or $$-\infty$$ if x is empty

real max(row_vector x)
The maximum value in x, or $$-\infty$$ if x is empty

real max(matrix x)
The maximum value in x, or $$-\infty$$ if x is empty

### 5.6.3 Sums and Products

real sum(vector x)
The sum of the values in x, or 0 if x is empty

real sum(row_vector x)
The sum of the values in x, or 0 if x is empty

real sum(matrix x)
The sum of the values in x, or 0 if x is empty

real prod(vector x)
The product of the values in x, or 1 if x is empty

real prod(row_vector x)
The product of the values in x, or 1 if x is empty

real prod(matrix x)
The product of the values in x, or 1 if x is empty

### 5.6.4 Sample Moments

Full definitions are provided for sample moments in section array reductions.

real mean(vector x)
The sample mean of the values in x; see section array reductions for details.

real mean(row_vector x)
The sample mean of the values in x; see section array reductions for details.

real mean(matrix x)
The sample mean of the values in x; see section array reductions for details.

real variance(vector x)
The sample variance of the values in x; see section array reductions for details.

real variance(row_vector x)
The sample variance of the values in x; see section array reductions for details.

real variance(matrix x)
The sample variance of the values in x; see section array reductions for details.

real sd(vector x)
The sample standard deviation of the values in x; see section array reductions for details.

real sd(row_vector x)
The sample standard deviation of the values in x; see section array reductions for details.

real sd(matrix x)
The sample standard deviation of the values in x; see section array reductions for details.