function Q = orthogonalize(u)

n = length(u);

Um = [ u randn(n,n-1) ];

for j = 1:n
	v = Um(:,j);
	for i = 1:j-1
		temp = Q(:,i)'*Um(:,j);
		v = v - temp*Q(:,i);
	end

	Q(:,j) = v/norm(v);
end	

				
return;