view general/numerical/matrix/inv_triu.m @ 42:ae596261e75f

Various fixes and development to audio handling
author samer
date Tue, 02 Dec 2014 14:51:13 +0000
parents db7f4afd27c5
children
line wrap: on
line source
function t=inv_triu(t)
% inv_triu - Inverse of upper triangular matrix
% 
% inv_triu :: [[N,N]] -> [[N,N]].

n=size(t,1);
for k=1:n
	if t(k,k)~=0
		t(k,k) = 1/t(k,k);
		t(1:k-1,k) = -t(1:k-1,k) * t(k,k);

		j = k+1:n;
		temp = t(k,j);
		t(k,j) = 0;
		t(1:k,j) = t(1:k,j) + t(1:k,k)*temp;
	end
end