當前位置: 首頁>>代碼示例>>Python>>正文


Python numpy.PZERO屬性代碼示例

本文整理匯總了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 
開發者ID:chainer,項目名稱:chainer,代碼行數:18,代碼來源:test_constants.py

示例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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:4,代碼來源:test_utils.py

示例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)) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:30,代碼來源:test_utils.py

示例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. 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:10,代碼來源:test_umath_complex.py

示例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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:29,代碼來源:test_umath_complex.py

示例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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:6,代碼來源:test_umath.py

示例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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:6,代碼來源:test_umath.py

示例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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:6,代碼來源:test_umath.py

示例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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:6,代碼來源:test_umath.py

示例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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:6,代碼來源:test_umath.py

示例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)) 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:30,代碼來源:test_utils.py

示例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) 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:8,代碼來源:test_umath_complex.py

示例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) 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:29,代碼來源:test_umath_complex.py


注:本文中的numpy.PZERO屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。