Mercurial > hg > ltpda
view m-toolbox/classes/@ao/mchol.m @ 13:e05504b18072 database-connection-manager
Move more functions to utils.repository
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% MCHOL. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: MCHOL % % CALL: % % VERSION: $Id: mchol.m,v 1.3 2008/10/06 12:47:46 ingo Exp $ % % HISTORY: ??-??-???? ??? % Creation % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function varargout = mchol(m) leng = length(m); for i=1:leng dets(i) = det(m(1:i, 1:i)); end sqdet = sqrt(dets); if isreal('sqdet')==0 error('### matrix not positive definite') end if(isa(m,'sym')) M = m; n = length( M ); L = vpa(zeros( n, n )); for i=1:n L(i, i) = sqrt( M(i, i) - L(i, :)*L(i, :)' ); for j=(i + 1):n L(j, i) = ( M(j, i) - L(i, :)*L(j, :)' )/L(i, i); end end % L = solve('L'); varargout{1} = L; end end