Exemple #1
0
def mvnrnd_pre(mu, Lambda):
    src = normrnd(size=(mu.shape[0], ))
    return solve_ut(cholesky_upper(
        Lambda, overwrite_a=True, check_finite=False),
                    src,
                    lower=False,
                    check_finite=False,
                    overwrite_b=True) + mu
Exemple #2
0
def mvnrnd_pre(mu, Lambda):
    # normal()函数生成一个size大小的np.array,采用正态分布随机采样,默认均值mu=0,标准差sigma=1.0
    src = normrnd(size=(mu.shape[0],))
    # solve_triangular() Solve the equation a x = b for x, assuming a is a triangular matrix.
    # lower = False,使用上三角,check_finite=False,不做无穷大检查,能提升运行速度,overwrite_b=True,允许对b参数进行重写.

    # Compute the Cholesky decomposition of a matrix.
    # Returns the Cholesky decomposition, A=LL* or A=U*U  of a Hermitian positive-definite matrix A.
    return solve_ut(cholesky_upper(Lambda, overwrite_a=True, check_finite=False),
                    src, lower=False, check_finite=False, overwrite_b=True) + mu