当前位置: 首页>>代码示例>>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;未经允许,请勿转载。