Documentation
¶
Index ¶
- func MaxIndex(a []FLOAT) int
- func MinIndex(a []FLOAT) int
- func MinMax(a []FLOAT) (minIndex int, minValue FLOAT, maxIndex int, maxValue FLOAT)
- type FLOAT
- func Abs(x []FLOAT) []FLOAT
- func AbsValue(x FLOAT) FLOAT
- func Add(a ...[]FLOAT) []FLOAT
- func AddOffset(a []FLOAT, offset FLOAT) []FLOAT
- func Average(a []FLOAT) FLOAT
- func AverageFilter(a []FLOAT, width int) []FLOAT
- func Copy(a []FLOAT) []FLOAT
- func Derivative(a []FLOAT) []FLOAT
- func EveryNth(a []FLOAT, n int) []FLOAT
- func MaxValue(a []FLOAT) FLOAT
- func MedianFilter(a []FLOAT, width int) []FLOAT
- func MinValue(a []FLOAT) FLOAT
- func Negative(a []FLOAT) []FLOAT
- func NthDerivative(a []FLOAT, n int) []FLOAT
- func Range(a, b int) []FLOAT
- func Repeat(x FLOAT, n int) []FLOAT
- func Reverse(x []FLOAT) []FLOAT
- func Scale(a []FLOAT, factor FLOAT) []FLOAT
- func Sub(a ...[]FLOAT) []FLOAT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxIndex ¶
MaxIndex returns the index of the maximum value in a. If a is empty, -1 is returned.
Types ¶
type FLOAT ¶
type FLOAT = float32
func Abs ¶
Abs returns a new array, the same length as x, with all values the absolute values of x, i.e. the value itself if it is >= 0 and the negative value if it is < 0.
func AbsValue ¶
Abs returns the absolute value of x, i.e. the value itself if it is >= 0 and the negative value if it is < 0.
func Add ¶
Add returns an array of the sums of the elements in all arrays of a. If the arrays in a have different lengths, the smallest of all lengths is used for the result.
func AverageFilter ¶
AverageFilter returns a new array of average filtered values over a. The resulting array is width-1 smaller than a. Neighboring elements (width neighbors) are averaged. If the width is 1 or smaller, a copy of the input array is returned. If width is greater than len(a), a one-element array with the average value over a is returned. For an empty input an empty output is returned.
func Derivative ¶
Derivative returns a slice one item smaller than a, with the differences between neighboring items. Result 0 is a[1]-a[0] and so on.
func EveryNth ¶
EveryNth constructs a new array from every nth item in a. The first item is always used. If n is <= 0, an empty array is returned.
func MedianFilter ¶
MedianFilter returns a new array of median filtered values over a. The resulting array is width-1 smaller than a. Neighboring elements (width neighbors) are sorted and the middle element replaces the origial. If the width is 1 or smaller, a copy of the input array is returned. If width is greater than len(a), a one-element array with the median value over a is returned. For an empty input an empty output is returned.
func Negative ¶
Negative returns a slice of the length of a with all elements the negations of those in a.
func NthDerivative ¶
NthDerivative applies Derivative n times to a. If n is <= 0, a copy of a is returned.
func Range ¶
Range returns an array containing all integer numbers in the range from a to b, both inclusive. The order of the number is the same as the order from a to b.
Examples:
Range(5, 8) => {5.0, 6.0, 7.0, 8.0} Range(2, -3) => {2.0, 1.0, 0.0, -1.0, -2.0, -3.0}
func Repeat ¶
Repeat makes a slice of FLOAT of length n and sets all values to x. If n <= 0 the returned slice is empty.