Adds matrix sub package & adds polynomial regression series (#36)

* updates

* updates

* tests.

* test coverage

* fixing test

* stride not rows + cols

* lu decomp implementation.

* poly regression!

* poly regression works.

* typo.
This commit is contained in:
Will Charczuk 2017-04-18 20:20:29 -07:00 committed by GitHub
parent b3dc3fef3c
commit a211e88530
10 changed files with 1292 additions and 9 deletions

36
matrix/util.go Normal file
View file

@ -0,0 +1,36 @@
package matrix
import (
"math"
"strconv"
)
func minInt(values ...int) int {
min := math.MaxInt32
for x := 0; x < len(values); x++ {
if values[x] < min {
min = values[x]
}
}
return min
}
func maxInt(values ...int) int {
max := math.MinInt32
for x := 0; x < len(values); x++ {
if values[x] > max {
max = values[x]
}
}
return max
}
func f64s(v float64) string {
return strconv.FormatFloat(v, 'f', -1, 64)
}
func roundToEpsilon(value, epsilon float64) float64 {
return math.Nextafter(value, value)
}