class in Clatter.Core
Extensions for doubles.
public static double Clamp(this double d, double a, double b)
Clamp this value to be between a and b.
| Name | Type | Description | 
|---|---|---|
| d | this double | (this) | 
| a | double | The lower bound. | 
| b | double | The upper bound (inclusive). | 
public static void Convolve(this double[] a, double[] kernel, int length, ref double[] result)
Convolve an array with the given kernel. Source: 7239016 This code is a more optimized version of the source.
| Name | Type | Description | 
|---|---|---|
| a | this double[] | (this) | 
| kernel | double[] | A convolution kernel. | 
| length | int | The length of the convolved array. | 
| result | ref double[] | The output array. | 
public static double Interpolate1D(this double value, double[] x, double[] y, double lower, double upper, int yIndexOffset, ref int startX, int endX)
Interpolates data using a piece-wise linear function. This has been optimized from the source. Source: Tools.cs#L669
| Name | Type | Description | 
|---|---|---|
| value | this double | The value to be calculated. | 
| x | double[] | The input data points x. Those values need to be sorted. | 
| y | double[] | The output data points y. | 
| lower | double | The value to be returned for values before the first point in x . | 
| upper | double | The value to be returned for values after the last point in x . | 
| yIndexOffset | int | Offset the y index by this value. | 
| startX | ref int | Start interpolating the x array at this index. | 
| endX | int | The final index in the x array. | 
public static float[] ToFloats(this double[] a, int length)
Returns this array converted to floats.
| Name | Type | Description | 
|---|---|---|
| a | this double[] | (this) | 
| length | int | The length of the converted array. | 
public static byte[] ToInt16Bytes(this double[] a, int length)
Returns this array converted to a byte array of int16s.
| Name | Type | Description | 
|---|---|---|
| a | this double[] | (this) | 
| length | int | The length of the converted array. | 
public static double MedianInPlace(this double[] data)
Estimates the median value from the unsorted data array. WARNING: Works inplace and can thus causes the data array to be reordered. Source: ArrayStatistics.cs#L413
| Name | Type | Description | 
|---|---|---|
| data | this double[] | Sample array, no sorting is assumed. Will be reordered. |