コード例 #1
0
ファイル: dist_matrix_test.go プロジェクト: soniakeys/cluster
func ExampleDistanceMatrix_ZeroDiagonal() {
	d1 := cluster.DistanceMatrix{
		{0, 3}, // true
		{3, 0},
	}
	d2 := cluster.DistanceMatrix{
		{0}, // true
		{7, 0},
	}
	d3 := cluster.DistanceMatrix{} // true
	d4 := cluster.DistanceMatrix{
		{0, 3},
		{3, 1e-300}, // false
	}
	fmt.Println(d1.ZeroDiagonal())
	fmt.Println(d2.ZeroDiagonal())
	fmt.Println(d3.ZeroDiagonal())
	fmt.Println(d4.ZeroDiagonal())
	// Output:
	// true
	// true
	// true
	// false
}