⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ldltbksb.c

📁 LDL 分解源码。从文件输入数据
💻 C
字号:
#include <stdio.h>

void LDLTBKSB (unsigned int n, double * *a, double *b)
/* This function can solve the symmetric linear determinantal equation after    */
/* the LDL' decomposition(can use different b[] with the same a[][]).           */
/* note:                                                                        */
/*    1. The matrix a[][] must already be decomposed to LDL'. Can use the       */
/*    matrix calculated after LDLTDCMP().                                       */
/* Parameter usage:                                                             */
/*  n    : The dimension of the determinantal equation.                         */
/*  a[][]: Input the LDL' matrix of the determinantal equation.                 */
/*         The form is that L is saved in the lower triangle of a[][](that      */
/*         is l[i][k] are in a[i][k]), D is saved in the a[i][i](that is d[i]   */
/*         are in a[i][i]), and temporary varible u[i][k] are in a[k][i].       */
/*  b[]  : Input the b vector(the dimension of a and b must be accordant),      */
/*         and the result of x[] are also saved in b[] after calculated.        */
/* Revision history:                                                            */
/*    2005.06.29       Zhu Songsheng(ZhuSongsheng@gmail.com)    initial begin   */
{
    int i;
    int k;
    for (i = 0; i < n; i++)
    {
        /* Calculate y[i], and saved in b[i] */
        for (k = 0; k < i; k++)
            b[i] = b[i] - a[i][k] * b[k];
    }
    for (i = n - 1; i >= 0; i--)
    {
        /* Calculate z[i], and saved in b[i] */
        b[i] = b[i] / a[i][i];
        /* Calculate x[i], and saved in b[i] */
        for (k = i + 1; k < n; k++)
            b[i] = b[i] - a[k][i] * b[k];
    }
    printf ("\n** The result of x[] are saved in b[] after calculated. **\n");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -