Skip to content
Advertisement

Cholesky factorisation not lower triangular

I am building a cholesky factorisation algorthim as proposed from the book:

Linear Algebra and Optimisation for Machine Learning

They provide the following algorthim:

enter image description here

I have attempted this with python with the following algorithm:

JavaScript

When testing this on a matrix I get upper triangular as opposed to lower triangular. Where was I mistaken?

JavaScript

Advertisement

Answer

You don’t even need to look at the detail of the algorithm.

Just see that in your book algorithm you have

JavaScript

So, necessarily, all elements whose line number i is greater or equal than column number j are filled. Rest is 0. Hence a lower triangle

In your algorithm on another hand you have

JavaScript

So all elements whose line number i is < to column number j, +1 (since i is in range(j+1), that is i<j+1, that is i<=j) are filled with something. Rest is 0.

Hence upper triangle

You probably wanted to

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement