Documentation
¶
Index ¶
- func CalculateOutputDataLengthAfterMA(inputDataLength, windowWidth int) int
- func EMA(inputData []float64, windowWidth int, expectedOutputDataLength int) ([]float64, error)
- func FindIntersectionDirections(referenceGraph []float64, investigatedGraph []float64) ([]string, error)
- func FindMax[N Numeric](data []N) (N, int, error)
- func FindMin[N Numeric](data []N) (N, int, error)
- func IsDataSortedASC[N Numeric](data []N) bool
- func IsDataSortedDESC[N Numeric](data []N) bool
- func SMA(inputData []float64, windowWidth int, expectedOutputDataLength int) ([]float64, error)
- func SmoothAdaptive(inData []float64, passesNum int) []float64
- func SmoothBy3Points(inData []float64, passesNum int) []float64
- func SmoothBy5Points(inData []float64, passesNum int) []float64
- func Subtract(initialData []float64, deductibleData []float64) ([]float64, error)
- func WMA(inputData []float64, windowWidth int, expectedOutputDataLength int) ([]float64, error)
- type LineDefinedByParameters
- type LineDefinedByTwoPoints
- type Numeric
- type PointCoordinates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateOutputDataLengthAfterMA ¶
CalculateOutputDataLengthAfterMA Calculates output data length after applying Moving Average window with width = windowWidth to incoming data set with length = inputDataLength
func EMA ¶
EMA - ExponentialMovingAverage expectedOutputDataLength is the required parameter for self-control. It should be known BEFORE doing smoothing, and if it is calculated incorrectly you can't handle obtained result in a right way. WARNING: Strictly said, when calculating EMA, we should CUT OFF FIRST windowWidth elements before return the result - in contrast to calculating SMA / WMA, But we cut off first windowWidth-1 elements in order to unify the result and make it the SAME LENGTH as the SMA and WMA result.
func IsDataSortedASC ¶
func IsDataSortedDESC ¶
func SMA ¶
SMA - SimpleMovingAverage expectedOutputDataLength is the required parameter for self-control. It should be known BEFORE doing smoothing, and if it is calculated incorrectly you can't handle obtained result in a right way.
func SmoothAdaptive ¶
SmoothAdaptive performs adaptive smoothing: 5-point smoothing in priority, but if there are not enough points for 5-point smoothing, it does 3-point smoothing, and if there are not enough points even for 3-p smoothing, it just returns the input
func SmoothBy3Points ¶
func SmoothBy5Points ¶
Types ¶
type LineDefinedByParameters ¶
func FindEquationOfLineGivenByTwoPoints ¶
func FindEquationOfLineGivenByTwoPoints(lineByTwoPoints LineDefinedByTwoPoints) (LineDefinedByParameters, error)
type LineDefinedByTwoPoints ¶
type LineDefinedByTwoPoints struct {
PointA PointCoordinates
PointB PointCoordinates
}
type PointCoordinates ¶
func FindIntersectionPointOfTwoSegments ¶
func FindIntersectionPointOfTwoSegments(lineA LineDefinedByTwoPoints, lineB LineDefinedByTwoPoints) (PointCoordinates, bool, error)
FindIntersectionPointOfTwoSegments - tries to solve a system of two linear equations and returns 3 parameters:
- Coordinates of intersection point if they are exist
- Boolean indicating if solution exists, or it does not for example, solution does not exist if: a) two lines are parallel, b) if intersection point exists, but it is outside of the common projection
- Error in other abnormal situation.
PLEASE NOTE: This function searches intersection of SEGMENTS, NOT LINES!!!