view general/numerical/matrix/inv_triu.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
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