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