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

17
matrix/vector.go Normal file
View file

@ -0,0 +1,17 @@
package matrix
// Vector is just an array of values.
type Vector []float64
// DotProduct returns the dot product of two vectors.
func (v Vector) DotProduct(v2 Vector) (result float64, err error) {
if len(v) != len(v2) {
err = ErrDimensionMismatch
return
}
for i := 0; i < len(v); i++ {
result = result + (v[i] * v2[i])
}
return
}