zoukankan      html  css  js  c++  java
  • Cholesky_decomposition

    from:
    http://en.wikipedia.org/wiki/Cholesky_decomposition

    The Cholesky-Banachiewicz and Cholesky-Crout algorithms

    If we write out the equation A = LL*,

    {\mathbf{A=LL^T}} =\begin{pmatrix}   L_{11} & 0 & 0 \\L_{21} & L_{22} & 0 \\L_{31} & L_{32} & L_{33}\\\end{pmatrix}\begin{pmatrix}   L_{11} & L_{21} & L_{31} \\0 & L_{22} & L_{32} \\0 & 0 & L_{33}\\\end{pmatrix}=\begin{pmatrix}   L_{11}^2 &   &(symmetric)   \\L_{21}L_{11} & L_{21}^2 + L_{22}^2& \\L_{31}L_{11} & L_{31}L_{21}+L_{32}L_{22} & L_{31}^2 + L_{32}^2+L_{33}^2 \\\end{pmatrix}

    we obtain the following formula for the entries of L:

    L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{i,k} L_{j,k} \right), \qquad\mbox{for } i>j.
    L_{i,i} = \sqrt{ A_{i,i} - \sum_{k=1}^{i-1} L_{i,k}^2 }.

    The expression under the square root is always positive if A is real and positive-definite.

    For complex Hermitian matrix, the following formula applies:

    L_{i,j} = \frac{1}{L_{j,j}} \left( A_{i,j} - \sum_{k=1}^{j-1} L_{i,k} L_{j,k}^* \right), \qquad\mbox{for } i>j.
    L_{i,i} = \sqrt{ A_{i,i} - \sum_{k=1}^{i-1} L_{i,k}L_{i,k}^* }.

    So we can compute the (i, j) entry if we know the entries to the left and above. The computation is usually arranged in either of the following orders.

    • The Cholesky-Banachiewicz algorithm starts from the upper left corner of the matrix L and proceeds to calculate the matrix row by row.
    • The Cholesky-Crout algorithm starts from the upper left corner of the matrix L and proceeds to calculate the matrix column by column.
    [edit] Stability of the computation

    Suppose that we want to solve a well-conditioned system of linear equations. If the LU decomposition is used, then the algorithm is unstable unless we use some sort of pivoting strategy. In the latter case, the error depends on the so-called growth factor of the matrix, which is usually (but not always) small.

    Now, suppose that the Cholesky decomposition is applicable. As mentioned above, the algorithm will be twice as fast. Furthermore, no pivoting is necessary and the error will always be small. Specifically, if we want to solve Ax = b, and y denotes the computed solution, then y solves the disturbed system (A + E)y = b where

    \|\mathbf{E}\|_2 \le c_n \varepsilon \|\mathbf{A}\|_2.

    Here, || ||2 is the matrix 2-norm, cn is a small constant depending on n, and ε denotes the unit round-off.

    There is one small problem with the Cholesky decomposition. Note that we must compute square roots in order to find the Cholesky decomposition. If the matrix is real symmetric and positive definite, then the numbers under the square roots are always positive in exact arithmetic. Unfortunately, the numbers can become negative because of round-off errors, in which case the algorithm cannot continue. However, this can only happen if the matrix is very ill-conditioned.

    [edit] Avoiding taking square roots

    An alternative form is the factorization[2]

    Cholesky_decomposition - wwweurope - wwweurope的博客

    This form eliminates the need to take square roots. When A is positive definite the elements of the diagonal matrix D are all positive. However this factorization can be used for any square, symmetrical matrix.

    The following recursive relations apply for the entries of D and L:

    L_{ij} = \frac{1}{D_{j}} \left( A_{ij} - \sum_{k=1}^{j-1} L_{ik} L_{jk} D_{k} \right), \qquad\mbox{for } i>j.
    D_{i} = A_{ii} - \sum_{k=1}^{i-1} L_{ik}^2 D_{k}

    For complex Hermitian matrix, the following formula applies:

    L_{ij} = \frac{1}{D_{j}} \left( A_{ij} - \sum_{k=1}^{j-1} L_{ik} L_{jk}^* D_{k} \right), \qquad\mbox{for } i>j.
    D_{i} = A_{ii} - \sum_{k=1}^{i-1} L_{ik}L_{ik}^* D_{k}
    refer to: Numerical Recipes in C++ ,2.9 cholesky decomposition.
    about implement code(it need sqrt, not above "Avoiding taking square roots").
  • 相关阅读:
    制作yaffs2文件系统
    nandwrite 参数
    linux并发控制之信号量
    mke2fs 制作ext2文件系统image
    stat文件状态信息结构体
    mount命令详解
    fiddler——http——cookie
    fiddler——http——请求方法、状态码
    http的cookie
    fiddler——http——header首部(请求首部和响应首部)——个人文档整理
  • 原文地址:https://www.cnblogs.com/europelee/p/3388672.html
Copyright © 2011-2022 走看看