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


Python umath.e方法代碼示例

本文整理匯總了Python中numpy.core.umath.e方法的典型用法代碼示例。如果您正苦於以下問題:Python umath.e方法的具體用法?Python umath.e怎麽用?Python umath.e使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在numpy.core.umath的用法示例。


在下文中一共展示了umath.e方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_ignore_object_identity_in_equal

# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import e [as 別名]
def test_ignore_object_identity_in_equal(self):
        # Check error raised when comparing identical objects whose comparison
        # is not a simple boolean, e.g., arrays that are compared elementwise.
        a = np.array([np.array([1, 2, 3]), None], dtype=object)
        assert_raises(ValueError, np.equal, a, a)

        # Check error raised when comparing identical non-comparable objects.
        class FunkyType(object):
            def __eq__(self, other):
                raise TypeError("I won't compare")

        a = np.array([FunkyType()])
        assert_raises(TypeError, np.equal, a, a)

        # Check identity doesn't override comparison mismatch.
        a = np.array([np.nan], dtype=object)
        assert_equal(np.equal(a, a), [False]) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:19,代碼來源:test_umath.py

示例2: test_ignore_object_identity_in_not_equal

# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import e [as 別名]
def test_ignore_object_identity_in_not_equal(self):
        # Check error raised when comparing identical objects whose comparison
        # is not a simple boolean, e.g., arrays that are compared elementwise.
        a = np.array([np.array([1, 2, 3]), None], dtype=object)
        assert_raises(ValueError, np.not_equal, a, a)

        # Check error raised when comparing identical non-comparable objects.
        class FunkyType(object):
            def __ne__(self, other):
                raise TypeError("I won't compare")

        a = np.array([FunkyType()])
        assert_raises(TypeError, np.not_equal, a, a)

        # Check identity doesn't override comparison mismatch.
        a = np.array([np.nan], dtype=object)
        assert_equal(np.not_equal(a, a), [True]) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:19,代碼來源:test_umath.py

示例3: test_e

# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import e [as 別名]
def test_e(self):
        assert_allclose(ncu.e, 2.718281828459045, 1e-15) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:4,代碼來源:test_umath.py

示例4: test_division_complex

# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import e [as 別名]
def test_division_complex(self):
        # check that implementation is correct
        msg = "Complex division implementation check"
        x = np.array([1. + 1.*1j, 1. + .5*1j, 1. + 2.*1j], dtype=np.complex128)
        assert_almost_equal(x**2/x, x, err_msg=msg)
        # check overflow, underflow
        msg = "Complex division overflow/underflow check"
        x = np.array([1.e+110, 1.e-110], dtype=np.complex128)
        y = x**2/x
        assert_almost_equal(y/x, [1, 1], err_msg=msg) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:12,代碼來源:test_umath.py

示例5: test_floor_division_complex

# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import e [as 別名]
def test_floor_division_complex(self):
        # check that implementation is correct
        msg = "Complex floor division implementation check"
        x = np.array([.9 + 1j, -.1 + 1j, .9 + .5*1j, .9 + 2.*1j], dtype=np.complex128)
        y = np.array([0., -1., 0., 0.], dtype=np.complex128)
        assert_equal(np.floor_divide(x**2, x), y, err_msg=msg)
        # check overflow, underflow
        msg = "Complex floor division overflow/underflow check"
        x = np.array([1.e+110, 1.e-110], dtype=np.complex128)
        y = np.floor_divide(x**2, x)
        assert_equal(y, [1.e+110, 0], err_msg=msg) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:13,代碼來源:test_umath.py

示例6: test_lower_align

# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import e [as 別名]
def test_lower_align(self):
        # check data that is not aligned to element size
        # i.e doubles are aligned to 4 bytes on i386
        d = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64)
        assert_equal(np.abs(d), d)
        assert_equal(np.negative(d), -d)
        np.negative(d, out=d)
        np.negative(np.ones_like(d), out=d)
        np.abs(d, out=d)
        np.abs(np.ones_like(d), out=d) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:12,代碼來源:test_umath.py

示例7: test_lower_align

# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import e [as 別名]
def test_lower_align(self):
        # check data that is not aligned to element size
        # i.e doubles are aligned to 4 bytes on i386
        d = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64)
        assert_equal(d.max(), d[0])
        assert_equal(d.min(), d[0]) 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:8,代碼來源:test_umath.py


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