function y = trace(X)
%y=trace(X)
%trace Compute the trace of matrix X

%       S.Halevy 7/31/92
%       Copyright (c) 1992 by the MathWizards

if nargin < 1
   error('not enough arguments')
end
if nargin > 1
   error('too many arguments')
end
if isvector(X)
   error('trace - argument must be a matrix')
end

y = sum(diag(X));

