• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python numpy.clongdouble函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中numpy.clongdouble函数的典型用法代码示例。如果您正苦于以下问题:Python clongdouble函数的具体用法?Python clongdouble怎么用?Python clongdouble使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了clongdouble函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_coercion

    def test_coercion(self):
        def res_type(a, b):
            return np.add(a, b).dtype
        self.check_promotion_cases(res_type)

        # Use-case: float/complex scalar * bool/int8 array
        #           shouldn't narrow the float/complex type
        for a in [np.array([True,False]), np.array([-3,12], dtype=np.int8)]:
            b = 1.234 * a
            assert_equal(b.dtype, np.dtype('f8'), "array type %s" % a.dtype)
            b = np.longdouble(1.234) * a
            assert_equal(b.dtype, np.dtype(np.longdouble),
                                                "array type %s" % a.dtype)
            b = np.float64(1.234) * a
            assert_equal(b.dtype, np.dtype('f8'), "array type %s" % a.dtype)
            b = np.float32(1.234) * a
            assert_equal(b.dtype, np.dtype('f4'), "array type %s" % a.dtype)
            b = np.float16(1.234) * a
            assert_equal(b.dtype, np.dtype('f2'), "array type %s" % a.dtype)

            b = 1.234j * a
            assert_equal(b.dtype, np.dtype('c16'), "array type %s" % a.dtype)
            b = np.clongdouble(1.234j) * a
            assert_equal(b.dtype, np.dtype(np.clongdouble),
                                                "array type %s" % a.dtype)
            b = np.complex128(1.234j) * a
            assert_equal(b.dtype, np.dtype('c16'), "array type %s" % a.dtype)
            b = np.complex64(1.234j) * a
            assert_equal(b.dtype, np.dtype('c8'), "array type %s" % a.dtype)
开发者ID:Kurios,项目名称:Project32,代码行数:29,代码来源:test_numeric.py


示例2: test_precisions_consistent

 def test_precisions_consistent(self):
     z = 1 + 1j
     for f in self.funcs:
         fcf = f(np.csingle(z))
         fcd = f(np.cdouble(z))
         fcl = f(np.clongdouble(z))
         assert_almost_equal(fcf, fcd, decimal=6, err_msg="fch-fcd %s" % f)
         assert_almost_equal(fcl, fcd, decimal=15, err_msg="fch-fcl %s" % f)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:8,代码来源:test_umath.py


示例3: test_int_from_infinite_longdouble___int__

 def test_int_from_infinite_longdouble___int__(self):
     x = np.longdouble(np.inf)
     assert_raises(OverflowError, x.__int__)
     with suppress_warnings() as sup:
         sup.record(np.ComplexWarning)
         x = np.clongdouble(np.inf)
         assert_raises(OverflowError, x.__int__)
         assert_equal(len(sup.log), 1)
开发者ID:danielballan,项目名称:numpy,代码行数:8,代码来源:test_scalarmath.py


示例4: test_longdouble_int

 def test_longdouble_int(self):
     # gh-627
     x = np.longdouble(np.inf)
     assert_raises(OverflowError, int, x)
     with suppress_warnings() as sup:
         sup.record(np.ComplexWarning)
         x = np.clongdouble(np.inf)
         assert_raises(OverflowError, int, x)
         assert_equal(len(sup.log), 1)
开发者ID:juliantaylor,项目名称:numpy,代码行数:9,代码来源:test_scalarmath.py


示例5: test_longdouble_int

 def test_longdouble_int(self):
     # gh-627
     x = np.longdouble(np.inf)
     assert_raises(OverflowError, x.__int__)
     x = np.clongdouble(np.inf)
     assert_raises(OverflowError, x.__int__)
开发者ID:birm,项目名称:numpy,代码行数:6,代码来源:test_scalarmath.py


示例6: Type

_cast_dict['LONG'] = _cast_dict['INT'] + ['LONG']
_cast_dict['ULONG'] = _cast_dict['UINT'] + ['ULONG']

_cast_dict['LONGLONG'] = _cast_dict['LONG'] + ['LONGLONG']
_cast_dict['ULONGLONG'] = _cast_dict['ULONG'] + ['ULONGLONG']

_cast_dict['FLOAT'] = _cast_dict['SHORT'] + ['USHORT', 'FLOAT']
_cast_dict['DOUBLE'] = _cast_dict['INT'] + ['UINT', 'FLOAT', 'DOUBLE']

_cast_dict['CFLOAT'] = _cast_dict['FLOAT'] + ['CFLOAT']

# 32 bit system malloc typically does not provide the alignment required by
# 16 byte long double types this means the inout intent cannot be satisfied
# and several tests fail as the alignment flag can be randomly true or fals
# when numpy gains an aligned allocator the tests could be enabled again
if ((intp().dtype.itemsize != 4 or clongdouble().dtype.alignment <= 8) and
        sys.platform != 'win32'):
    _type_names.extend(['LONGDOUBLE', 'CDOUBLE', 'CLONGDOUBLE'])
    _cast_dict['LONGDOUBLE'] = _cast_dict['LONG'] + \
        ['ULONG', 'FLOAT', 'DOUBLE', 'LONGDOUBLE']
    _cast_dict['CLONGDOUBLE'] = _cast_dict['LONGDOUBLE'] + \
        ['CFLOAT', 'CDOUBLE', 'CLONGDOUBLE']
    _cast_dict['CDOUBLE'] = _cast_dict['DOUBLE'] + ['CFLOAT', 'CDOUBLE']


class Type(object):
    _type_cache = {}

    def __new__(cls, name):
        if isinstance(name, dtype):
            dtype0 = name
开发者ID:Nodd,项目名称:numpy,代码行数:31,代码来源:test_array_from_pyobj.py


示例7: test_gentype_nonzero

    def test_gentype_nonzero( self ):

        # This exercises gentype_nonzero, and thus may point the path to
        # executing other gentype_* functions.
        z = np.clongdouble( 4 + 5j )
        r = np.nonzero( z )
开发者ID:258073127,项目名称:MissionPlanner,代码行数:6,代码来源:test_scalarmath.py



注:本文中的numpy.clongdouble函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python numpy.column_stack函数代码示例发布时间:2022-05-27
下一篇:
Python numpy.clip函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap