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


Python numeric.zeros方法代码示例

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


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

示例1: __setitem__

# 需要导入模块: from numpy.core import numeric [as 别名]
# 或者: from numpy.core.numeric import zeros [as 别名]
def __setitem__(self, key, val):
        ind = self.order - key
        if key < 0:
            raise ValueError("Does not support negative powers.")
        if key > self.order:
            zr = NX.zeros(key-self.order, self.coeffs.dtype)
            self._coeffs = NX.concatenate((zr, self.coeffs))
            ind = 0
        self._coeffs[ind] = val
        return 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:12,代码来源:polynomial.py

示例2: __init__

# 需要导入模块: from numpy.core import numeric [as 别名]
# 或者: from numpy.core.numeric import zeros [as 别名]
def __init__(self, *shape):
        if len(shape) == 1 and isinstance(shape[0], tuple):
            shape = shape[0]
        x = as_strided(_nx.zeros(1), shape=shape,
                       strides=_nx.zeros_like(shape))
        self._it = _nx.nditer(x, flags=['multi_index', 'zerosize_ok'],
                              order='C') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:9,代码来源:index_tricks.py

示例3: __setitem__

# 需要导入模块: from numpy.core import numeric [as 别名]
# 或者: from numpy.core.numeric import zeros [as 别名]
def __setitem__(self, key, val):
        ind = self.order - key
        if key < 0:
            raise ValueError("Does not support negative powers.")
        if key > self.order:
            zr = NX.zeros(key-self.order, self.coeffs.dtype)
            self.__dict__['coeffs'] = NX.concatenate((zr, self.coeffs))
            self.__dict__['order'] = key
            ind = 0
        self.__dict__['coeffs'][ind] = val
        return 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:13,代码来源:polynomial.py

示例4: __init__

# 需要导入模块: from numpy.core import numeric [as 别名]
# 或者: from numpy.core.numeric import zeros [as 别名]
def __init__(self, *shape):
        if len(shape) == 1 and isinstance(shape[0], tuple):
            shape = shape[0]
        x = as_strided(_nx.zeros(1), shape=shape, strides=_nx.zeros_like(shape))
        self._it = _nx.nditer(x, flags=['multi_index', 'zerosize_ok'],
                              order='C') 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:index_tricks.py

示例5: make_mask_none

# 需要导入模块: from numpy.core import numeric [as 别名]
# 或者: from numpy.core.numeric import zeros [as 别名]
def make_mask_none (s):
    "Return a mask of all zeros of shape s."
    result = numeric.zeros(s, dtype=MaskType)
    result.shape = s
    return result 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:ma.py

示例6: zeros

# 需要导入模块: from numpy.core import numeric [as 别名]
# 或者: from numpy.core.numeric import zeros [as 别名]
def zeros (shape, dtype=float):
    """zeros(n, dtype=float) =
     an array of all zeros of the given length or shape."""
    return array(numeric.zeros(shape, dtype)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:ma.py

示例7: inner

# 需要导入模块: from numpy.core import numeric [as 别名]
# 或者: from numpy.core.numeric import zeros [as 别名]
def inner(a, b):
    """inner(a,b) returns the dot product of two arrays, which has
    shape a.shape[:-1] + b.shape[:-1] with elements computed by summing the
    product of the elements from the last dimensions of a and b.
    Masked elements are replace by zeros.
    """
    fa = filled(a, 0)
    fb = filled(b, 0)
    if len(fa.shape) == 0: fa.shape = (1,)
    if len(fb.shape) == 0: fb.shape = (1,)
    return masked_array(numeric.inner(fa, fb)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:13,代码来源:ma.py

示例8: dot

# 需要导入模块: from numpy.core import numeric [as 别名]
# 或者: from numpy.core.numeric import zeros [as 别名]
def dot(a, b):
    """dot(a,b) returns matrix-multiplication between a and b.  The product-sum
    is over the last dimension of a and the second-to-last dimension of b.
    Masked values are replaced by zeros. See also innerproduct.
    """
    return innerproduct(filled(a, 0), numeric.swapaxes(filled(b, 0), -1, -2)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:ma.py


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