%% Function pivotelement( M ) 
%%
%% By: Michael K. Pellegrino
%%
%% input: M = a kxn matrix
%% output: [retr,retc] = a matrix of the element [(row,column)] to pivot
%%

function [retr retc] = pivotelement( M )
  [nrow,ncol]=size( M );

  %% replace all -1's with the max value
  %% so we can use the "min" function
  c = pivotcol(M);
  if( c == -1 )
    disp( "no more pivot columns" );
    retr=-1;
    retr=-1;
    return;
  endif
  r = pivotrowmin( pivotratios( M, c ) );
  retr=r;
  retc=c;
endfunction
