1

As we know, Cholesky decomposition of $A = L*L^T$.

I tried to write a simple function to decompose the lower triangular matrix $L$. I know there is a C++ function of GSL/gsl_linalg_cholesky_ decomp that can do it. I read its manual but I do not quite understand. Anyone can help?


I was asked to offer the manual of the function, which is http://www.gnu.org/software/gsl/manual/html_node/Cholesky-Decomposition.html# 1 index-gsl 005flinalg 005fcholesky 005fdecomp-1343

Bill the Lizard
  • 1,042
  • 2
  • 11
  • 30
  • How about a link to the thing you want us to tell you how to use? – Glen_b Jun 04 '14 at 06:02
  • @Glen_b if you mean the manual, this is the link http://www.gnu.org/software/gsl/manual/html_node/Cholesky-Decomposition.html# 1 index-gsl 005flinalg 005fcholesky 005fdecomp-1343 thanks for stop by! – user40596 Jun 04 '14 at 06:28
  • Okay, the manual seems utterly clear to me. What's the difficulty? – Glen_b Jun 04 '14 at 07:25
  • @Glen_b ok...please understand there is some stupid people in the world, like me. I do not understand the manual...If you have time could you show a simple sample about how to composite triangle matrix L? – user40596 Jun 04 '14 at 07:40
  • 1
    Don't call yourself stupid - for starters, you immediately imply I'm wasting my time. Second, that wasn't the point... I can't guess what you don't understand about what it says, since it explicitly tells you where $L$ and $L^T$ are in the output of the function. If you can't understand what it says (which is fine), and you also can't tell me where the difficulty lies in understanding what it says, how will me explaining the information again help? If I can't guess where the problem lies and you won't narrow it down, what am I to do? (Lastly, what does "how to composite" mean?) – Glen_b Jun 04 '14 at 08:11
  • @user40596, if you want the simplest pseudocode of Cholesky decomposition, I can give it – ttnphns Jun 04 '14 at 08:23

2 Answers2

5

The function you link to takes an input matrix, $A$ (symmetric positive semidefinite), and gives back a matrix with $L$ and $L^T$ in it:

enter image description here

Both $L$ and $L^T$ include the diagonal (marked in white above).

So if you need for some reason to have $L$ by itself (for many purposes you'll probably be able to use it directly from the returned matrix), you can copy the relevant elements out.

Glen_b
  • 282,281
1

The accepted answer from Glen_b is outdated or slightly incorrect. Based on the reference gsl_linalg_complex_cholesky_decomp (gsl_linalg_cholesky_decomp is deprecated):

On output the diagonal and lower triangular part of the input matrix A contain the matrix L, while the upper triangular part contains the original matrix.

So, $L^{T}$ is NOT on the output result. If you need $L^{T}$, you just access $L$ with the index of row and column inverted.