mirror of
https://github.com/sjwhitworth/golearn.git
synced 2025-04-26 13:49:14 +08:00
Run goftm on all files ti fix indentation
This commit is contained in:
parent
ad77c0dc7e
commit
13327e9250
@ -26,7 +26,7 @@ func (self *Chebyshev) Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) floa
|
||||
|
||||
for i := 0; i < r1; i++ {
|
||||
for j := 0; j < c1; j++ {
|
||||
max = math.Max(max, math.Abs(vectorX.At(i, j) - vectorY.At(i, j)))
|
||||
max = math.Max(max, math.Abs(vectorX.At(i, j)-vectorY.At(i, j)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ func TestChebyshev(t *testing.T) {
|
||||
chebyshev := NewChebyshev()
|
||||
|
||||
Convey("Given two vectors", t, func() {
|
||||
vectorX = mat64.NewDense(4, 1, []float64{ 1, 2, 3, 4 })
|
||||
vectorY = mat64.NewDense(4, 1, []float64{ -5, -6, 7, 8 })
|
||||
vectorX = mat64.NewDense(4, 1, []float64{1, 2, 3, 4})
|
||||
vectorY = mat64.NewDense(4, 1, []float64{-5, -6, 7, 8})
|
||||
|
||||
Convey("When calculating distance with two vectors", func() {
|
||||
result := chebyshev.Distance(vectorX, vectorY)
|
||||
|
@ -16,7 +16,7 @@ func cranberraDistanceStep(num float64, denom float64) float64 {
|
||||
if num == .0 && denom == .0 {
|
||||
return .0
|
||||
} else {
|
||||
return num/denom
|
||||
return num / denom
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ func TestCranberrra(t *testing.T) {
|
||||
cranberra := NewCranberra()
|
||||
|
||||
Convey("Given two vectors that are same", t, func() {
|
||||
vec := mat64.NewDense(7, 1, []float64 { 0, 1, -2, 3.4, 5, -6.7, 89 })
|
||||
vec := mat64.NewDense(7, 1, []float64{0, 1, -2, 3.4, 5, -6.7, 89})
|
||||
distance := cranberra.Distance(vec, vec)
|
||||
|
||||
Convey("The result should be 0", func() {
|
||||
@ -20,10 +20,9 @@ func TestCranberrra(t *testing.T) {
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Convey("Given two vectors", t, func() {
|
||||
vectorX = mat64.NewDense(5, 1, []float64{ 1, 2, 3, 4, 9 })
|
||||
vectorY = mat64.NewDense(5, 1, []float64{ -5, -6, 7, 4, 3 })
|
||||
vectorX = mat64.NewDense(5, 1, []float64{1, 2, 3, 4, 9})
|
||||
vectorY = mat64.NewDense(5, 1, []float64{-5, -6, 7, 4, 3})
|
||||
|
||||
Convey("When calculating distance with two vectors", func() {
|
||||
result := cranberra.Distance(vectorX, vectorY)
|
||||
|
@ -12,7 +12,7 @@ func TestManhattan(t *testing.T) {
|
||||
manhattan := NewManhattan()
|
||||
|
||||
Convey("Given two vectors that are same", t, func() {
|
||||
vec := mat64.NewDense(7, 1, []float64 { 0, 1, -2, 3.4, 5, -6.7, 89 })
|
||||
vec := mat64.NewDense(7, 1, []float64{0, 1, -2, 3.4, 5, -6.7, 89})
|
||||
distance := manhattan.Distance(vec, vec)
|
||||
|
||||
Convey("The result should be 0", func() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user