nb.py 文件源码

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

项目:hippylib 作者: hippylib 项目源码 文件源码
def plot_eigenvectors(Vh, U, mytitle, which = [0,1,2,5,10,15]):
    assert len(which) % 3 == 0
    nrows = len(which) / 3
    subplot_loc = nrows*100 + 30
    plt.figure(figsize=(18,4*nrows))

    title_stamp = mytitle + " {0}" 
    u = dl.Function(Vh)
    counter=1
    for i in which:
        assert i < U.shape[1]
        Ui = U[:,i]
        if Ui[0] >= 0:
            s = 1./np.linalg.norm(Ui, np.inf)
        else:
            s = -1./np.linalg.norm(Ui, np.inf)
        u.vector().set_local(s*Ui)
        plot(u, subplot_loc=(subplot_loc+counter), mytitle=title_stamp.format(i), vmin=-1, vmax=1)
        counter = counter+1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号