本文整理汇总了Python中numpy.PZERO属性的典型用法代码示例。如果您正苦于以下问题:Python numpy.PZERO属性的具体用法?Python numpy.PZERO怎么用?Python numpy.PZERO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类numpy
的用法示例。
在下文中一共展示了numpy.PZERO属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_constants
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_constants():
assert chainerx.Inf is numpy.Inf
assert chainerx.Infinity is numpy.Infinity
assert chainerx.NAN is numpy.NAN
assert chainerx.NINF is numpy.NINF
assert chainerx.NZERO is numpy.NZERO
assert chainerx.NaN is numpy.NaN
assert chainerx.PINF is numpy.PINF
assert chainerx.PZERO is numpy.PZERO
assert chainerx.e is numpy.e
assert chainerx.euler_gamma is numpy.euler_gamma
assert chainerx.inf is numpy.inf
assert chainerx.infty is numpy.infty
assert chainerx.nan is numpy.nan
assert chainerx.newaxis is numpy.newaxis
assert chainerx.pi is numpy.pi
示例2: test_negative_zero
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_negative_zero(self):
self._test_not_equal(np.PZERO, np.NZERO)
示例3: test_nan
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_nan(self):
# Test that nan is 'far' from small, tiny, inf, max and min
for dt in [np.float32, np.float64]:
if dt == np.float32:
maxulp = 1e6
else:
maxulp = 1e12
inf = np.array([np.inf]).astype(dt)
nan = np.array([np.nan]).astype(dt)
big = np.array([np.finfo(dt).max])
tiny = np.array([np.finfo(dt).tiny])
zero = np.array([np.PZERO]).astype(dt)
nzero = np.array([np.NZERO]).astype(dt)
assert_raises(AssertionError,
lambda: assert_array_max_ulp(nan, inf,
maxulp=maxulp))
assert_raises(AssertionError,
lambda: assert_array_max_ulp(nan, big,
maxulp=maxulp))
assert_raises(AssertionError,
lambda: assert_array_max_ulp(nan, tiny,
maxulp=maxulp))
assert_raises(AssertionError,
lambda: assert_array_max_ulp(nan, zero,
maxulp=maxulp))
assert_raises(AssertionError,
lambda: assert_array_max_ulp(nan, nzero,
maxulp=maxulp))
示例4: test_simple
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_simple(self):
check_real_value(ncu._arg, 1, 0, 0, False)
check_real_value(ncu._arg, 0, 1, 0.5*np.pi, False)
check_real_value(ncu._arg, 1, 1, 0.25*np.pi, False)
check_real_value(ncu._arg, np.PZERO, np.PZERO, np.PZERO)
# TODO This can be xfail when the generator functions are got rid of.
示例5: test_zero
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_zero(self):
# carg(-0 +- 0i) returns +- pi
check_real_value(ncu._arg, np.NZERO, np.PZERO, np.pi, False)
check_real_value(ncu._arg, np.NZERO, np.NZERO, -np.pi, False)
# carg(+0 +- 0i) returns +- 0
check_real_value(ncu._arg, np.PZERO, np.PZERO, np.PZERO)
check_real_value(ncu._arg, np.PZERO, np.NZERO, np.NZERO)
# carg(x +- 0i) returns +- 0 for x > 0
check_real_value(ncu._arg, 1, np.PZERO, np.PZERO, False)
check_real_value(ncu._arg, 1, np.NZERO, np.NZERO, False)
# carg(x +- 0i) returns +- pi for x < 0
check_real_value(ncu._arg, -1, np.PZERO, np.pi, False)
check_real_value(ncu._arg, -1, np.NZERO, -np.pi, False)
# carg(+- 0 + yi) returns pi/2 for y > 0
check_real_value(ncu._arg, np.PZERO, 1, 0.5 * np.pi, False)
check_real_value(ncu._arg, np.NZERO, 1, 0.5 * np.pi, False)
# carg(+- 0 + yi) returns -pi/2 for y < 0
check_real_value(ncu._arg, np.PZERO, -1, 0.5 * np.pi, False)
check_real_value(ncu._arg, np.NZERO, -1, -0.5 * np.pi, False)
#def test_branch_cuts(self):
# _check_branch_cut(ncu._arg, -1, 1j, -1, 1)
示例6: test_zero_nzero
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_zero_nzero(self):
# atan2(+-0, -0) returns +-pi.
assert_almost_equal(ncu.arctan2(np.PZERO, np.NZERO), np.pi)
assert_almost_equal(ncu.arctan2(np.NZERO, np.NZERO), -np.pi)
示例7: test_zero_pzero
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_zero_pzero(self):
# atan2(+-0, +0) returns +-0.
assert_arctan2_ispzero(np.PZERO, np.PZERO)
assert_arctan2_isnzero(np.NZERO, np.PZERO)
示例8: test_zero_negative
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_zero_negative(self):
# atan2(+-0, x) returns +-pi for x < 0.
assert_almost_equal(ncu.arctan2(np.PZERO, -1), np.pi)
assert_almost_equal(ncu.arctan2(np.NZERO, -1), -np.pi)
示例9: test_zero_positive
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_zero_positive(self):
# atan2(+-0, x) returns +-0 for x > 0.
assert_arctan2_ispzero(np.PZERO, 1)
assert_arctan2_isnzero(np.NZERO, 1)
示例10: test_positive_zero
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_positive_zero(self):
# atan2(y, +-0) returns +pi/2 for y > 0.
assert_almost_equal(ncu.arctan2(1, np.PZERO), 0.5 * np.pi)
assert_almost_equal(ncu.arctan2(1, np.NZERO), 0.5 * np.pi)
示例11: test_nan
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_nan(self):
# Test that nan is 'far' from small, tiny, inf, max and min
for dt in [np.float32, np.float64]:
if dt == np.float32:
maxulp = 1e6
else:
maxulp = 1e12
inf = np.array([np.inf]).astype(dt)
nan = np.array([np.nan]).astype(dt)
big = np.array([np.finfo(dt).max])
tiny = np.array([np.finfo(dt).tiny])
zero = np.array([np.PZERO]).astype(dt)
nzero = np.array([np.NZERO]).astype(dt)
self.assertRaises(AssertionError,
lambda: assert_array_max_ulp(nan, inf,
maxulp=maxulp))
self.assertRaises(AssertionError,
lambda: assert_array_max_ulp(nan, big,
maxulp=maxulp))
self.assertRaises(AssertionError,
lambda: assert_array_max_ulp(nan, tiny,
maxulp=maxulp))
self.assertRaises(AssertionError,
lambda: assert_array_max_ulp(nan, zero,
maxulp=maxulp))
self.assertRaises(AssertionError,
lambda: assert_array_max_ulp(nan, nzero,
maxulp=maxulp))
示例12: test_simple
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_simple(self):
check_real_value(ncu._arg, 1, 0, 0, False)
check_real_value(ncu._arg, 0, 1, 0.5*np.pi, False)
check_real_value(ncu._arg, 1, 1, 0.25*np.pi, False)
check_real_value(ncu._arg, np.PZERO, np.PZERO, np.PZERO)
示例13: test_zero
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import PZERO [as 别名]
def test_zero(self):
# carg(-0 +- 0i) returns +- pi
yield check_real_value, ncu._arg, np.NZERO, np.PZERO, np.pi, False
yield check_real_value, ncu._arg, np.NZERO, np.NZERO, -np.pi, False
# carg(+0 +- 0i) returns +- 0
yield check_real_value, ncu._arg, np.PZERO, np.PZERO, np.PZERO
yield check_real_value, ncu._arg, np.PZERO, np.NZERO, np.NZERO
# carg(x +- 0i) returns +- 0 for x > 0
yield check_real_value, ncu._arg, 1, np.PZERO, np.PZERO, False
yield check_real_value, ncu._arg, 1, np.NZERO, np.NZERO, False
# carg(x +- 0i) returns +- pi for x < 0
yield check_real_value, ncu._arg, -1, np.PZERO, np.pi, False
yield check_real_value, ncu._arg, -1, np.NZERO, -np.pi, False
# carg(+- 0 + yi) returns pi/2 for y > 0
yield check_real_value, ncu._arg, np.PZERO, 1, 0.5 * np.pi, False
yield check_real_value, ncu._arg, np.NZERO, 1, 0.5 * np.pi, False
# carg(+- 0 + yi) returns -pi/2 for y < 0
yield check_real_value, ncu._arg, np.PZERO, -1, 0.5 * np.pi, False
yield check_real_value, ncu._arg, np.NZERO, -1, -0.5 * np.pi, False
#def test_branch_cuts(self):
# _check_branch_cut(ncu._arg, -1, 1j, -1, 1)