


% -*- texinfo -*-
% @deftypefn {Function File} {[@var{yy}, @var{idx}] =} sortcom (@var{xx}[, @var{opt}])
% Sort a complex vector.
%
% @strong{Inputs}
% @table @var
% @item xx
% Complex vector
% @item opt
% sorting option:
% @table @code
% @item 're'
% Real part (default);
% @item 'mag'
% By magnitude;
% @item 'im'
% By imaginary part.
% @end table
% if @var{opt} is not chosen as @code{'im'}, then complex conjugate pairs are grouped together,
% @math{a - jb} followed by @math{a + jb}.
% @end table
%
% @strong{Outputs}
% @table @var
% @item yy
% Sorted values
% @item idx
% Permutation vector: @code{yy = xx(idx)}
% @end table
% @end deftypefn