當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。