function d = leibniz(a)

%
%Compute the determinant of a square matrix
%using Leibniz' definition of determinant.
%

n = length(a);
p = perms(1:n);
d = 0;
   for i = 1:length(p), d = d + perm_sign(p(i,:))*prod((diag(a(1:n,p(i,:)))));
   end;
end;
