function L=Chole(A)
% L = Chole (A)
% Descomposicion elemental de Cholesky
% A : Matriz SPD
% L : Matrix triangular inferior t.q. A = LL'
% Programador: Fredy Vides
n=size(A,1);
L(1,1)=sqrt(A(1,1));
L(2:n,1)=A(2:n,1)/L(1,1);
for k=2:n,
    L(k,k)=sqrt(A(k,k)-L(k,1:(k-1))*L(k,1:(k-1))');
    for i=(k+1):n
        L(i,k)=(A(i,k)-L(i,1:(k-1))*L(k,1:(k-1))')/L(k,k);
    end
end