本文整理汇总了Python中numpy.core.isscalar方法的典型用法代码示例。如果您正苦于以下问题:Python core.isscalar方法的具体用法?Python core.isscalar怎么用?Python core.isscalar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.core
的用法示例。
在下文中一共展示了core.isscalar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __mul__
# 需要导入模块: from numpy import core [as 别名]
# 或者: from numpy.core import isscalar [as 别名]
def __mul__(self, other):
if isscalar(other):
return poly1d(self.coeffs * other)
else:
other = poly1d(other)
return poly1d(polymul(self.coeffs, other.coeffs))
示例2: __rmul__
# 需要导入模块: from numpy import core [as 别名]
# 或者: from numpy.core import isscalar [as 别名]
def __rmul__(self, other):
if isscalar(other):
return poly1d(other * self.coeffs)
else:
other = poly1d(other)
return poly1d(polymul(self.coeffs, other.coeffs))
示例3: __pow__
# 需要导入模块: from numpy import core [as 别名]
# 或者: from numpy.core import isscalar [as 别名]
def __pow__(self, val):
if not isscalar(val) or int(val) != val or val < 0:
raise ValueError("Power to non-negative integers only.")
res = [1]
for _ in range(val):
res = polymul(self.coeffs, res)
return poly1d(res)
示例4: __div__
# 需要导入模块: from numpy import core [as 别名]
# 或者: from numpy.core import isscalar [as 别名]
def __div__(self, other):
if isscalar(other):
return poly1d(self.coeffs/other)
else:
other = poly1d(other)
return polydiv(self, other)
示例5: __rdiv__
# 需要导入模块: from numpy import core [as 别名]
# 或者: from numpy.core import isscalar [as 别名]
def __rdiv__(self, other):
if isscalar(other):
return poly1d(other/self.coeffs)
else:
other = poly1d(other)
return polydiv(other, self)