当前位置: 首页>>代码示例>>Python>>正文


Python umath.subtract方法代码示例

本文整理汇总了Python中numpy.core.umath.subtract方法的典型用法代码示例。如果您正苦于以下问题:Python umath.subtract方法的具体用法?Python umath.subtract怎么用?Python umath.subtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy.core.umath的用法示例。


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

示例1: _ptp

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import subtract [as 别名]
def _ptp(a, axis=None, out=None, keepdims=False):
    return um.subtract(
        umr_maximum(a, axis, None, out, keepdims),
        umr_minimum(a, axis, None, None, keepdims),
        out
    ) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:8,代码来源:_methods.py

示例2: __sub__

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import subtract [as 别名]
def __sub__(self, other):
        "Return subtract(self, other)"
        return subtract(self, other) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:ma.py

示例3: __rsub__

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import subtract [as 别名]
def __rsub__(self, other):
        "Return subtract(other, self)"
        return subtract(other, self) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:ma.py

示例4: __isub__

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import subtract [as 别名]
def __isub__(self, other):
        "Subtract other from self in place."
        t = self._data.dtype.char
        f = filled(other, 0)
        t1 = f.dtype.char
        if t == t1:
            pass
        elif t in typecodes['Integer']:
            if t1 in typecodes['Integer']:
                f = f.astype(t)
            else:
                raise TypeError('Incorrect type for in-place operation.')
        elif t in typecodes['Float']:
            if t1 in typecodes['Integer']:
                f = f.astype(t)
            elif t1 in typecodes['Float']:
                f = f.astype(t)
            else:
                raise TypeError('Incorrect type for in-place operation.')
        elif t in typecodes['Complex']:
            if t1 in typecodes['Integer']:
                f = f.astype(t)
            elif t1 in typecodes['Float']:
                f = f.astype(t)
            elif t1 in typecodes['Complex']:
                f = f.astype(t)
            else:
                raise TypeError('Incorrect type for in-place operation.')
        else:
            raise TypeError('Incorrect type for in-place operation.')

        if self._mask is nomask:
            self._data -= f
            m = getmask(other)
            self._mask = m
            self._shared_mask = m is not nomask
        else:
            result = subtract(self, masked_array(f, mask=getmask(other)))
            self._data = result.data
            self._mask = result.mask
            self._shared_mask = 1
        return self 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:44,代码来源:ma.py


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