schemes.py 文件源码

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

项目:orthopy 作者: nschloe 项目源码 文件源码
def _gauss_from_coefficients_mpmath(alpha, beta, decimal_places):
    mp.dps = decimal_places

    # Create vector cut of the first value of beta
    n = len(alpha)
    b = mp.zeros(n, 1)
    for i in range(n-1):
        b[i] = mp.sqrt(beta[i+1])

    z = mp.zeros(1, n)
    z[0, 0] = 1
    d = mp.matrix(alpha)
    tridiag_eigen(mp, d, b, z)

    # nx1 matrix -> list of sympy floats
    x = numpy.array([sympy.Float(xx) for xx in d])
    w = numpy.array([beta[0] * mp.power(ww, 2) for ww in z])
    return x, w
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号