function invrnd
  format compact
  fid=fopen('invrnd_m.out','w');
  sprintf('invrnd.m running\n')
  fprintf(fid,'invrnd.m running \n');
  n=1;
  for r=1:8
    n=2*n;
    A=zeros(n,n);
    B=rand(n,n);
    for i=1:n
      for j=1:n
        A(i,j)=1.0/(i+j);
      end
    end
    avgerr=sum(sum(abs(A*inv(A)-eye(n,n))))/(n*n);
    sprintf('n=%d, avgerr=%g \n', n,avgerr)
    fprintf(fid,'n=%d, avgerr=%g \n', n,avgerr);
    rnderr=sum(sum(abs(B*inv(B)-eye(n,n))))/(n*n);
    sprintf('n=%d, rnderr=%g \n', n,rnderr)
    fprintf(fid,'n=%d, rnderr=%g \n', n,rnderr);
  end
end