📜  cholesky 分解 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:49.234000             🧑  作者: Mango

代码示例1
for (i = 0; i < dimensionSize; i++) {
    for (j = 0; j < (i + 1); j++) {
        float sum = 0;
        for (k = 0; k < j; k++)
            sum += L[i][k] * L[j][k];

        if (i == j)
            L[i][j] = sqrt(A[i][i] - sum);
        else
            L[i][j] = (1.0 / L[j][j] * (A[i][j] - sum));
    }
}