本文整理汇总了Python中numpy.core.umath.hypot函数的典型用法代码示例。如果您正苦于以下问题:Python hypot函数的具体用法?Python hypot怎么用?Python hypot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hypot函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple
def test_simple(self):
assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
assert_almost_equal(ncu.hypot(0, 0), 0)
示例2: assert_hypot_isinf
def assert_hypot_isinf(x, y):
err = np.seterr(invalid="ignore")
try:
assert_(np.isinf(ncu.hypot(x, y)), "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y)))
finally:
np.seterr(**err)
示例3: assert_hypot_isnan
def assert_hypot_isnan(x, y):
err = np.seterr(invalid='ignore')
try:
assert np.isnan(ncu.hypot(x, y)), "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))
finally:
np.seterr(**err)
示例4: assert_hypot_isinf
def assert_hypot_isinf(x, y):
with np.errstate(invalid='ignore'):
assert_(np.isinf(ncu.hypot(x, y)),
"hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y)))
示例5: assert_hypot_isinf
def assert_hypot_isinf(x, y):
assert np.isinf(ncu.hypot(x, y)), "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))
示例6: assert_hypot_isnan
def assert_hypot_isnan(x, y):
assert np.isnan(ncu.hypot(x, y)), "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))
示例7: assert_hypot_isinf
def assert_hypot_isinf(x, y):
assert np.isinf(ncu.hypot(x, y))
示例8: assert_hypot_isnan
def assert_hypot_isnan(x, y):
assert np.isnan(ncu.hypot(x, y))
示例9: assert_hypot_isnan
def assert_hypot_isnan(x, y):
with np.errstate(invalid="ignore"):
assert_(np.isnan(ncu.hypot(x, y)), "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y)))