For a SPD matrix A, there exists Cholesky factorization $A=LL^T$ or $A=R^TR$, where L, R are a lower and upper triangular matrix, respectively.
Also in matlab, there has a command R = chol(A) which produces $A=R^TR$. and another command L = chol(A,'lower') which produces $A=LL^T$. But when I implement these two commands with a same large sparse SPD matrix A, L = chol(A,'lower') is faster than R = chol(A) so mysterious. why this happens? Thanks.
clc;clear; n =400; A = gallery('poisson',n); tic R = chol(A);% generate the triangular matrix such that A = R'*R toc tic L = chol(A,'lower');% generate the lower matrix such that A = L*L' toc
I have run the example 3 times and the numerical results are as follows which indeed demonstrates that the above words what I said (my cpu is 8GB memory and matlab 2018b):
Elapsed time is 12.089711 seconds. Elapsed time is 8.467380 seconds. Elapsed time is 10.372768 seconds. Elapsed time is 8.131158 seconds. Elapsed time is 10.027861 seconds. Elapsed time is 8.105706 seconds.