コード例 #1
0
ファイル: dist_matrix_test.go プロジェクト: soniakeys/cluster
func ExampleDistanceMatrix_Symmetric() {
	d1 := cluster.DistanceMatrix{
		{0, 3}, // true
		{3, 0},
	}
	d2 := cluster.DistanceMatrix{
		{0, 3}, // false
		{7, 0},
	}
	d3 := cluster.DistanceMatrix{
		{0, math.NaN()}, // false (NaNs do not compare equal)
		{math.NaN(), 0},
	}
	d4 := cluster.DistanceMatrix{
		{0, 3}, // true (diagonal is not checked)
		{3, math.NaN()},
	}
	fmt.Println(d1.Symmetric())
	fmt.Println(d2.Symmetric())
	fmt.Println(d3.Symmetric())
	fmt.Println(d4.Symmetric())
	// Output:
	// true
	// false
	// false
	// true
}