def test_compute_N_03(self): k = 0.0 p = np.array([0.0, 0.05], dtype=np.float32) normal_p = np.array([-np.sqrt(0.5), -np.sqrt(0.5)]) a = np.array([0.0, 0.00], dtype=np.float32) b = np.array([0.0, 0.10], dtype=np.float32) pOnElement = True zPy = IH2.compute_n(k, p, normal_p, a, b, pOnElement) zC = IH2C.compute_n(k, p, normal_p, a, b, pOnElement) self.assertAlmostEqual(zPy, zC, msg="{} != {}".format(zPy, zC))
def test_compute_N_04(self): k = 10.0 p = np.array([0.0, 0.05], dtype=np.float32) normal_p = np.array([-np.sqrt(0.5), -np.sqrt(0.5)]) a = np.array([0.0, 0.00], dtype=np.float32) b = np.array([0.0, 0.10], dtype=np.float32) pOnElement = True zPy = IH2.compute_n(k, p, normal_p, a, b, pOnElement) zC = IH2C.compute_n(k, p, normal_p, a, b, pOnElement) # note, how accuracy here is reduced to only 3 digits after the decimal dot. # I don't believe this is because of buggy code but because of error accumulation # being different for the C and the Python codes. self.assertAlmostEqual(zPy, zC, 3, msg="{} != {}".format(zPy, zC))