|
47 | 47 | test_metricity(SqEuclidean(), x, y, z)
|
48 | 48 | test_metricity(Euclidean(), x, y, z)
|
49 | 49 | test_metricity(Cityblock(), x, y, z)
|
| 50 | + test_metricity(TotalVariation(), x, y, z) |
50 | 51 | test_metricity(Chebyshev(), x, y, z)
|
51 | 52 | test_metricity(Minkowski(2.5), x, y, z)
|
52 | 53 |
|
|
122 | 123 |
|
123 | 124 | @test euclidean(a, b) == 1.0
|
124 | 125 | @test cityblock(a, b) == 1.0
|
| 126 | + @test totalvariation(a, b) == 0.5 |
125 | 127 | @test chebyshev(a, b) == 1.0
|
126 | 128 | @test minkowski(a, b, 2) == 1.0
|
127 | 129 | @test hamming(a, b) == 1
|
|
140 | 142 | @test euclidean(x, y) == sqrt(57.0)
|
141 | 143 | @test jaccard(x, y) == 13.0 / 28
|
142 | 144 | @test cityblock(x, y) == 13.0
|
| 145 | + @test totalvariation(x, y) == 6.5 |
143 | 146 | @test chebyshev(x, y) == 6.0
|
144 | 147 | @test braycurtis(x, y) == 1.0 - (30.0 / 43.0)
|
145 | 148 | @test minkowski(x, y, 2) == sqrt(57.0)
|
@@ -242,6 +245,8 @@ end #testset
|
242 | 245 | @test isa(euclidean(a, b), T)
|
243 | 246 | @test cityblock(a, b) == 0.0
|
244 | 247 | @test isa(cityblock(a, b), T)
|
| 248 | + @test totalvariation(a, b) == 0.0 |
| 249 | + @test isa(totalvariation(a, b), T) |
245 | 250 | @test chebyshev(a, b) == 0.0
|
246 | 251 | @test isa(chebyshev(a, b), T)
|
247 | 252 | @test braycurtis(a, b) == 0.0
|
|
385 | 390 | test_colwise(SqEuclidean(), X, Y, T)
|
386 | 391 | test_colwise(Euclidean(), X, Y, T)
|
387 | 392 | test_colwise(Cityblock(), X, Y, T)
|
| 393 | + test_colwise(TotalVariation(), X, Y, T) |
388 | 394 | test_colwise(Chebyshev(), X, Y, T)
|
389 | 395 | test_colwise(Minkowski(2.5), X, Y, T)
|
390 | 396 | test_colwise(Hamming(), A, B, T)
|
|
459 | 465 | test_pairwise(SqEuclidean(), X, Y, T)
|
460 | 466 | test_pairwise(Euclidean(), X, Y, T)
|
461 | 467 | test_pairwise(Cityblock(), X, Y, T)
|
| 468 | + test_pairwise(TotalVariation(), X, Y, T) |
462 | 469 | test_pairwise(Chebyshev(), X, Y, T)
|
463 | 470 | test_pairwise(Minkowski(2.5), X, Y, T)
|
464 | 471 | test_pairwise(Hamming(), A, B, T)
|
|
0 commit comments