SpeicalMatrix.py 文件源码

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

项目:Matrix-Analysis 作者: kingofspace0wzz 项目源码 文件源码
def householder_vector(x):

    dimensionX  = len(x)
    sigma = x[1:].conjugate().T.dot(x[1:])
    v = np.vstack((1, x[1:]))

    if sigma == 0:
        beta = 0
        return v, beta
    else:
        miu = np.sqrt(x[0]**2 / sigma)
        if x[0] <= 0:
            v[0] = x[0] - miu
        else:
            v[0] = - sigma / (x[0] + miu)
        beta = 2 * v[0]**2 / (sigma + v[0]**2)
        v = v / la.norm(v, 2)

        return v, beta

# a test fuction that asks whether a particular matrix is one of the special matries above
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号