Python numpy.core.umath.subtract() Examples

The following are 13 code examples of numpy.core.umath.subtract(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module numpy.core.umath , or try the search function .
Example #1
Source File: _methods.py    From recruit with Apache License 2.0 5 votes vote down vote up
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
    ) 
Example #2
Source File: _methods.py    From lambda-packs with MIT License 5 votes vote down vote up
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
    ) 
Example #3
Source File: ma.py    From Computable with MIT License 5 votes vote down vote up
def __sub__(self, other):
        "Return subtract(self, other)"
        return subtract(self, other) 
Example #4
Source File: ma.py    From Computable with MIT License 5 votes vote down vote up
def __rsub__(self, other):
        "Return subtract(other, self)"
        return subtract(other, self) 
Example #5
Source File: _methods.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
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
    ) 
Example #6
Source File: _methods.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
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
    ) 
Example #7
Source File: _methods.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
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
    ) 
Example #8
Source File: _methods.py    From pySINDy with MIT License 5 votes vote down vote up
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
    ) 
Example #9
Source File: _methods.py    From coffeegrindsize with MIT License 5 votes vote down vote up
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
    ) 
Example #10
Source File: _methods.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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
    ) 
Example #11
Source File: _methods.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
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
    ) 
Example #12
Source File: _methods.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
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
    ) 
Example #13
Source File: ma.py    From Computable with MIT License 4 votes vote down vote up
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