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").
  • 相关阅读:
    python 学习——sqlalchemy 模块
    python学习——数据库基本知识mysql
    算法设计22——并行算法2 实际应用中的优化
    Perl 学习
    python学习——装饰器、生成器、迭代器
    算法设计19—— 全对最短路径 Floyd算法
    asp.net Core 使用过滤器判断请求客户端是否为移动端,并实现PC端和移动端请求映射和自动跳转
    在windows平台使用Apache James搭建邮件服务器以及使用C#向外网发送邮件
    asp.net core3.1策略授权问题
    Unity调用安卓中的方法遇到的问题
  • 原文地址:https://www.cnblogs.com/europelee/p/3388672.html
Copyright © 2011-2022 走看看