Example #1
0
func ExampleDistanceMatrix_NonNegative() {
	d1 := cluster.DistanceMatrix{
		{0, -1}, // false
		{-1, 0},
	}
	d2 := cluster.DistanceMatrix{
		{0}, // true
		{1, 2},
	}
	d3 := cluster.DistanceMatrix{} // true (no negatives present)
	d4 := cluster.DistanceMatrix{
		{0, math.NaN()}, // true
		{3, 0},
	}
	fmt.Println(d1.NonNegative())
	fmt.Println(d2.NonNegative())
	fmt.Println(d3.NonNegative())
	fmt.Println(d4.NonNegative())
	// Outpupt:
	// false
	// true
	// true
	// true
}