function iout=natrixindexcomposemy(indin,sz);
  ## Opposite of natrixindexdecomposemy
  ## Indin is a row vector. 1xK of the k indices of the matrix which has
  ## a size sz. We return iout: the corresponding single index composed
  ## from the k indices.
  ##
  ## If indin has multiple rows (R), we return the corresponding iouts
  ## for each row.

  indin=indin-1;
  
  iout=zeros(rows(indin),1);
  
  mul=1;
  for ii=1:columns(indin);
    iout=iout+mul*indin(:,ii);
    mul=mul*sz(ii);
  endfor
  iout=iout+1;
endfunction

  
  
  
