mirror of
https://github.com/gonum/gonum.git
synced 2025-10-09 00:50:16 +08:00
Changed order of signature in Nearest
This commit is contained in:
@@ -236,7 +236,7 @@ func Min(s []float64) (min float64, ind int) {
|
|||||||
// nearest to v. If several such indices exist, the lowest index
|
// nearest to v. If several such indices exist, the lowest index
|
||||||
// is returned
|
// is returned
|
||||||
// TODO: Add test
|
// 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])
|
dist := math.Abs(v - s[0])
|
||||||
ind = 0
|
ind = 0
|
||||||
for i, val := range s {
|
for i, val := range s {
|
||||||
|
@@ -284,7 +284,7 @@ func TestMin(t *testing.T) {
|
|||||||
|
|
||||||
func TestNearest(t *testing.T) {
|
func TestNearest(t *testing.T) {
|
||||||
//s := []float64{3, 5, 6.2, 6.2, 8}
|
//s := []float64{3, 5, 6.2, 6.2, 8}
|
||||||
//ind
|
//ind := Nearest(s, )
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNorm(t *testing.T) {
|
func TestNorm(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user