Changed order of signature in Nearest

This commit is contained in:
btracey
2013-07-26 10:27:19 -07:00
parent 260d7da58c
commit a45071abd3
2 changed files with 2 additions and 2 deletions

View File

@@ -236,7 +236,7 @@ func Min(s []float64) (min float64, ind int) {
// nearest to v. If several such indices exist, the lowest index
// is returned
// TODO: Add test
func Nearest(s []float64, v float64) (ind int) {
func Nearest(v float64, s []float64) (ind int) {
dist := math.Abs(v - s[0])
ind = 0
for i, val := range s {

View File

@@ -284,7 +284,7 @@ func TestMin(t *testing.T) {
func TestNearest(t *testing.T) {
//s := []float64{3, 5, 6.2, 6.2, 8}
//ind
//ind := Nearest(s, )
}
func TestNorm(t *testing.T) {