// return index of an element in the internal
// mtx.e array of double ( element 0 is allocated but
// mostly ignored for pascal/f77 like indexing over
// C style array double*
function idx(a:mtx; i, j: longint):longint;
begin
  assert( (i>0) and (i<=a.lgn) );
  assert( (j>0) and (j<=a.col) );
  idx := 1 + pred(i)*a.dc + pred(j)*a.dl;
end;
