예제 #1
0
 def test_nicdm_basic_requirements(self):
     """Test that matrix is symmetric, diag==0, and in range [0, inf)"""
     self.setUpMod('rnd')
     nicdm_dist = nicdm(self.dist)
     symmetric = np.all(nicdm_dist == nicdm_dist.T)
     diag_zero = np.all(nicdm_dist.diagonal() == 0.)
     correct_range = nicdm_dist.min() >= 0.
     return self.assertTrue(symmetric and diag_zero and correct_range)
예제 #2
0
 def test_nicdm(self):
     self.setUpMod('toy')
     dist_calc = nicdm(self.dist, k=2)
     calc_equals_truth = np.allclose(dist_calc, self.nicdm_dist_truth)
     return self.assertTrue(calc_equals_truth)