quad_pdhg.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:HSISeg 作者: HSISeg 项目源码 文件源码
def cond_projsplx_multi(Y,a_mat):
    n, m = Y.shape
    A = a_mat
    s = -np.sort(-(A*Y),axis=1)
    index = np.argsort(-(A*Y), axis=1)
    tmpsum = np.zeros(n) 
    tmpsumdom = np.zeros(n)
    bget = np.zeros(n, dtype=bool)
    A_sort = A[np.arange(np.shape(A)[0])[:,np.newaxis], index]
    cond_s = s/(A_sort**2)
    tmax = np.zeros(n)
    for ii in xrange(0,m-1):
        active = (bget==False)
        tmpsum[active] = tmpsum[active] + cond_s[active][:,ii]
        tmpsumdom[active] = tmpsumdom[active]+ 1.0/A_sort[active][:,ii]**2
        tmax[active] = (tmpsum[active] - 1)/tmpsumdom[active]
        deactivate = (tmax >= s[:,ii+1]) & active
        bget[deactivate] = True
    active = (bget==False)
    tmax[active] = (tmpsum[active] + cond_s[active][:,m-1] - 1)/(tmpsumdom[active]+1.0/(A_sort[active][:,m-1])**2)
    X = (Y - np.matlib.repmat(tmax.reshape(n,1),1,m)*1.0/A)
    X[X<0.0] = 0.0
    X = X/A
    return X
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号