function f=alldls(ldlt,mu1,s) % solution of a symmetric linear system where the coefficient matrix % have been factorized by a preceding call to alldlf. % function f=alldls(ldlt,mu1,s) % where ldlt and mu1 are row vectors and f and s are column vectors. % (c) 2006 Alain Hebert, Ecole Polytechnique de Montreal n=size(s,1) ; f=zeros(n,1) ; if n == 1 f(1)=s(1)*ldlt(mu1(1)) ; return end f(1)=s(1) ; k1=mu1(1)+1 ; for i=2:n k2=mu1(i) ; kj=i-k2+k1 ; f(i)=s(i)-sum(f(kj:i-1).*ldlt(k1:k2-1)') ; k1=k2+1 ; end f(1:n)=f(1:n).*ldlt(mu1(1:n))' ; k2=mu1(n) ; for i=n:-1:2 k1=mu1(i-1)+1 ; kj=i-k2+k1 ; f(kj:i-1)=f(kj:i-1)-f(i)*ldlt(k1:k2-1)' ; k2=k1-1 ; end