本文整理汇总了Python中numpy.core.umath.hypot方法的典型用法代码示例。如果您正苦于以下问题:Python umath.hypot方法的具体用法?Python umath.hypot怎么用?Python umath.hypot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.core.umath
的用法示例。
在下文中一共展示了umath.hypot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import hypot [as 别名]
def test_simple(self):
assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
assert_almost_equal(ncu.hypot(0, 0), 0)
示例2: test_reduce
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import hypot [as 别名]
def test_reduce(self):
assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
assert_equal(ncu.hypot.reduce([]), 0.0)
示例3: assert_hypot_isnan
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import hypot [as 别名]
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)))
示例4: assert_hypot_isinf
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import hypot [as 别名]
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: test_no_fpe
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import hypot [as 别名]
def test_no_fpe(self):
assert_no_warnings(ncu.hypot, np.inf, 0)