function [avg, stdev, r] = ourstats(x,tol)
% OURSTATS finds the "average", "standard
% deviation", and "rank" of a matrix
if nargin <= 1
  tol = .05;
end
[m,n] = size(x);
if m == 1
	m = n;
end
avg = sum(x)/m;
if nargout > 1
  stdev = sqrt(sum(x.^2)/m - avg.^2);
  s = svd(x);
  r = sum(s > tol);
end
