Class Doubles

• ```public final class Doubles
extends Object```
Doubles.
Author:
Hendrik Schreiber
• Method Summary

All Methods
Modifier and Type Method Description
`static void` `abs​(double[] array)`
Changes all values to their absolute values.
`static double` `arithmeticMean​(double[] array)`
Computes the arithmetic mean of the array.
`static double` ```arithmeticMean​(double[] array, int start, int end)```
Computes the arithmetic mean of a portion of an array.
`static float[]` `castToFloats​(double[] doubles)`
`static double` ```cubicInterpolate​(double y0, double y1, double y2, double y3, double x)```
If f(0)=y0, f(1)=y1, f(2)=y2, and f(3)=y3, this function finds the degree-three polynomial which best fits these points and returns the value of this polynomial at a value x.
`static double` ```cubicMaximize​(double y0, double y1, double y2, double y3)```
`static double` `max​(double[] array)`
Calculates the min value of a given array.
`static double` `mean​(double[] array)`
Computes mean.
`static double` `min​(double[] array)`
Calculates the min value of a given array.
`static void` ```normalize​(double[][] arrayOfArrays, double scale)```
Normalizes the values in the given arrays to values `0..scale`.
`static void` ```normalize​(double[] array, double scale)```
Normalizes the values in the given array to values `0..scale`.
`static void` ```scale​(double[] array, double scale)```
Scale the values in the given array so that the maximum is `scale` Note: This method manipulates the provided array.
`static double` `standardDeviation​(double[] data)`
`static double` `sum​(double[] array)`
`static double` `variance​(double[] array)`
• Methods inherited from class java.lang.Object

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

• arithmeticMean

```public static double arithmeticMean​(double[] array,
int start,
int end)```
Computes the arithmetic mean of a portion of an array.
Parameters:
`array` - array
`start` - first index (incl)
`end` - last index (excl)
Returns:
mean
• arithmeticMean

`public static double arithmeticMean​(double[] array)`
Computes the arithmetic mean of the array.
Parameters:
`array` - array
Returns:
mean
• mean

`public static double mean​(double[] array)`
Computes mean.
Parameters:
`array` - array of doubles
Returns:
mean
• sum

`public static double sum​(double[] array)`
• abs

`public static void abs​(double[] array)`
Changes all values to their absolute values.
Parameters:
`array` - array of doubles
• min

`public static double min​(double[] array)`
Calculates the min value of a given array.
Parameters:
`array` - array of doubles
Returns:
minimum
• max

`public static double max​(double[] array)`
Calculates the min value of a given array.
Parameters:
`array` - array of doubles
Returns:
max
• scale

```public static void scale​(double[] array,
double scale)```
Scale the values in the given array so that the maximum is `scale` Note: This method manipulates the provided array.
Parameters:
`array` - array of doubles
`scale` - scale
• variance

`public static double variance​(double[] array)`
• standardDeviation

`public static double standardDeviation​(double[] data)`
• normalize

```public static void normalize​(double[] array,
double scale)```
Normalizes the values in the given array to values `0..scale`. Note: This method manipulates the provided array.
Parameters:
`array` - array of doubles
`scale` - scale
• normalize

```public static void normalize​(double[][] arrayOfArrays,
double scale)```
Normalizes the values in the given arrays to values `0..scale`. Note: This method manipulates the provided array.
Parameters:
`arrayOfArrays` - array of double arrays
`scale` - scale
• cubicInterpolate

```public static double cubicInterpolate​(double y0,
double y1,
double y2,
double y3,
double x)```
If f(0)=y0, f(1)=y1, f(2)=y2, and f(3)=y3, this function finds the degree-three polynomial which best fits these points and returns the value of this polynomial at a value x. Usually 0 < x < 3
Parameters:
`y0` - y0
`y1` - y1
`y2` - y2
`y3` - y3
`x` - x
Returns:
cubic interpolation
• cubicMaximize

```public static double cubicMaximize​(double y0,
double y1,
double y2,
double y3)```
Parameters:
`y0` - y0
`y1` - y1
`y2` - y2
`y3` - y3
Returns:
cubic maximum
• castToFloats

`public static float[] castToFloats​(double[] doubles)`