org.openimaj.math.util

## Class FloatArrayStatsUtils

• ```public class FloatArrayStatsUtils
extends Object```
Some basic statistical operations on float arrays
Author:
Sina Samangooei (ss@ecs.soton.ac.uk)
• ### Constructor Summary

Constructors
Constructor and Description
`FloatArrayStatsUtils()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static float` `mean(float[] arr)`
Find the mean of a single dimensional float array.
`static float` `mean(float[][] arr)`
Calculate the mean of a two dimensional float array.
`static float` `median(float[] arr)`
Calculate the median of the given array.
`static float` ```median(float[] arr, int start, int stop)```
Calculate the median of the given sub-array.
`static float` `std(float[] arr)`
Calculate the standard deviation of a 1D array.
`static float` `std(float[][] arr)`
Calculate the standard deviation of a 2D array.
`static float` `sum(float[] arr)`
Calculate the sum of a 1D array.
`static float` `sum(float[][] arr)`
Calculate the sum of a 2D array.
`static float` `sumAbs(float[] arr)`
Calculate the sum the absolute values of a 1D array.
`static float` `sumAbs(float[][] arr)`
Calculate the sum of the absolute values of a 2D array.
`static float` `sumSq(float[] arr)`
Calculate the sum the squared values of a 1D array.
`static float` `sumSq(float[][] arr)`
Calculate the sum of the squared values of a 2D array.
`static float` `var(float[] arr)`
Calculate the variance of a one dimensional float array.
`static float` `var(float[][] arr)`
Calculate the variance of a one dimensional float array.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### FloatArrayStatsUtils

`public FloatArrayStatsUtils()`
• ### Method Detail

• #### mean

`public static float mean(float[] arr)`
Find the mean of a single dimensional float array. returns 0 if the array is empty.
Parameters:
`arr` -
Returns:
the mean
• #### mean

`public static float mean(float[][] arr)`
Calculate the mean of a two dimensional float array. returns 0 if the array is empty.
Parameters:
`arr` -
Returns:
the mean
• #### var

`public static float var(float[] arr)`
Calculate the variance of a one dimensional float array. If the length of the array is less than 2, variance is 0.
Parameters:
`arr` -
Returns:
the variance
• #### var

`public static float var(float[][] arr)`
Calculate the variance of a one dimensional float array. If the length of the array is less than 2, variance is 0.
Parameters:
`arr` -
Returns:
the variance
• #### std

`public static float std(float[][] arr)`
Calculate the standard deviation of a 2D array. Calls `var(float[][])` and does a Math.sqrt.
Parameters:
`arr` -
Returns:
the standard deviation
• #### std

`public static float std(float[] arr)`
Calculate the standard deviation of a 1D array. Calls `var(float[])` and does a Math.sqrt.
Parameters:
`arr` -
Returns:
the standard deviation
• #### sum

`public static float sum(float[][] arr)`
Calculate the sum of a 2D array.
Parameters:
`arr` -
Returns:
the sum
• #### sum

`public static float sum(float[] arr)`
Calculate the sum of a 1D array.
Parameters:
`arr` -
Returns:
the sum
• #### sumSq

`public static float sumSq(float[][] arr)`
Calculate the sum of the squared values of a 2D array.
Parameters:
`arr` -
Returns:
sum of squares
• #### sumSq

`public static float sumSq(float[] arr)`
Calculate the sum the squared values of a 1D array.
Parameters:
`arr` -
Returns:
sum of squares
• #### sumAbs

`public static float sumAbs(float[][] arr)`
Calculate the sum of the absolute values of a 2D array.
Parameters:
`arr` -
Returns:
the sum absolute values
• #### sumAbs

`public static float sumAbs(float[] arr)`
Calculate the sum the absolute values of a 1D array.
Parameters:
`arr` -
Returns:
the sum absolute values
• #### median

`public static float median(float[] arr)`
Calculate the median of the given array. Uses the quick select algorithm (`ArrayUtils.quickSelect(float[], int)`).
Parameters:
`arr` - the array
Returns:
the median value
• #### median

```public static float median(float[] arr,
int start,
int stop)```
Calculate the median of the given sub-array. Uses the quick select algorithm (`ArrayUtils.quickSelect(float[], int, int, int)`).
Parameters:
`arr` - the array
`start` - starting point in the array (inclusive)
`stop` - stopping point in the array (exclusive)
Returns:
the median value