本文整理匯總了Python中numpy.core.umath.divide方法的典型用法代碼示例。如果您正苦於以下問題:Python umath.divide方法的具體用法?Python umath.divide怎麽用?Python umath.divide使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類numpy.core.umath
的用法示例。
在下文中一共展示了umath.divide方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __div__
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import divide [as 別名]
def __div__(self, other):
"Return divide(self, other)"
return divide(self, other)
示例2: __rdiv__
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import divide [as 別名]
def __rdiv__(self, other):
"Return divide(other, self)"
return divide(other, self)
示例3: __truediv__
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import divide [as 別名]
def __truediv__(self, other):
"Return divide(self, other)"
return true_divide(self, other)
示例4: __rtruediv__
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import divide [as 別名]
def __rtruediv__(self, other):
"Return divide(other, self)"
return true_divide(other, self)
示例5: __floordiv__
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import divide [as 別名]
def __floordiv__(self, other):
"Return divide(self, other)"
return floor_divide(self, other)
示例6: __idiv__
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import divide [as 別名]
def __idiv__(self, other):
"Divide self by other 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.')
mo = getmask(other)
result = divide(self, masked_array(f, mask=mo))
self._data = result.data
dm = result.raw_mask()
if dm is not self._mask:
self._mask = dm
self._shared_mask = 1
return self