% Filename spdtest.m Gerox(c) 1999
%  ‰ð“š‚P
clear all
a=peaks(1000);
tic;
rownum = 1;
colnum = 1;
maxval=a(1,1);
[row,col]=size(a);
for cntrow=1:row
  for cntcol=1:col
   if (a(cntrow,cntcol) > maxval)
     maxval = a(cntrow,cntcol);
     rownum = cntrow;
     colnum = cntcol;
   end
  end
end
[rownum,colnum,maxval,toc]
%‰ð“š‚Q
clear all
a=peaks(1000);
tic;
rownum = 1;
colnum = 1;
maxval=a(1,1);
[row,col]=size(a);
for cntrow=1:row
   [tmaxval tmaxind]=max(a(cntrow,1:col));
   if (tmaxval > maxval)
     maxval = tmaxval;
     rownum = cntrow;
     colnum = tmaxind;
  end
end
[rownum,colnum,maxval,toc]
%‰ð“š3
clear all
a=peaks(1000);
tic;
[rownum,colnum,maxval]=find(max(max(a))==a);
[rownum,colnum,a(rownum,colnum),toc]
%‰ð“š4
clear all
a=peaks(1000);
tic;
[maxvec,rowvec]=max(a);
[maxval,colnum]=max(maxvec);
[rowvec(colnum),colnum,maxval,toc]
%‰ð“š5
clear all
a=peaks(1000);
tic;
[row,col]=size(a);
[val,num]=max(a(:));
%rownum=rem(num,row); bug
rownum=rem(num-1,row)+1;
colnum=(num-rownum)/row+1;
[rownum,colnum,a(rownum,colnum),toc]

