當前位置: 首頁>>代碼示例>>Python>>正文


Python scipy.zeros_like方法代碼示例

本文整理匯總了Python中scipy.zeros_like方法的典型用法代碼示例。如果您正苦於以下問題:Python scipy.zeros_like方法的具體用法?Python scipy.zeros_like怎麽用?Python scipy.zeros_like使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scipy的用法示例。


在下文中一共展示了scipy.zeros_like方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _RLSortRoots

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import zeros_like [as 別名]
def _RLSortRoots(mymat):
    """Sort the roots from sys._RLFindRoots, so that the root
    locus doesn't show weird pseudo-branches as roots jump from
    one branch to another."""

    sorted = zeros_like(mymat)
    for n, row in enumerate(mymat):
        if n == 0:
            sorted[n, :] = row
        else:
            # sort the current row by finding the element with the
            # smallest absolute distance to each root in the
            # previous row
            available = list(range(len(prevrow)))
            for elem in row:
                evect = elem-prevrow[available]
                ind1 = abs(evect).argmin()
                ind = available.pop(ind1)
                sorted[n, ind] = elem
        prevrow = sorted[n, :]
    return sorted 
開發者ID:python-control,項目名稱:python-control,代碼行數:23,代碼來源:rlocus.py

示例2: ranktrafo

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import zeros_like [as 別名]
def ranktrafo(data):
    X = data.values[:, None]
    Is = X.argsort(axis=0)
    RV = sp.zeros_like(X)
    rank = sp.zeros_like(X)
    for i in xrange(X.shape[1]):
        x =  X[:,i]
        rank = sp.stats.rankdata(x)
        rank /= (X.shape[0]+1)
        RV[:,i] = sp.sqrt(2) * sp.special.erfinv(2*rank-1)

    return RV.flatten() 
開發者ID:MicrosoftResearch,項目名稱:Azimuth,代碼行數:14,代碼來源:util.py


注:本文中的scipy.zeros_like方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。