Modify sorting with REORD. Document same.

This commit is contained in:
sfilippone
2025-10-08 12:55:23 +02:00
parent ed97717037
commit 246bd70b3a
57 changed files with 3817 additions and 2915 deletions
+19 -9
View File
@@ -1791,10 +1791,10 @@ Returned as: an \verb|integer(psb_long_int_k_)| number.
{\par\noindent\large\bfseries psb\_hsort --- Sorting by the Heapsort algorithm}
\begin{verbatim}
call psb_isort(x,ix,dir,flag)
call psb_msort(x,ix,dir,flag)
call psb_qsort(x,ix,dir,flag)
call psb_hsort(x,ix,dir,flag)
call psb_isort(x,ix,dir,flag,reord)
call psb_msort(x,ix,dir,flag,reord)
call psb_qsort(x,ix,dir,flag,reord)
call psb_hsort(x,ix,dir,flag,reord)
\end{verbatim}
These serial routines sort a sequence $X$ into ascending or
@@ -1809,7 +1809,8 @@ Type:{\bf required}.\\
Specified as: an integer, real or complex array of rank 1.
\item[ix] A vector of indices.\\
Type:{\bf optional}.\\
Specified as: an integer array of (at least) the same size as $X$.
Specified as: an integer array of (at least) the same size as
$X$. This argument is required when $reord=psb\_sort\_noreord\_x\_$.
\item[dir] The desired ordering.\\
Type:{\bf optional}.\\
Specified as: an integer value: \begin{description}
@@ -1824,18 +1825,24 @@ default \verb|psb_lsort_up_|.
Type:{\bf optional}.\\
Specified as: an integer value \verb|psb_sort_ovw_idx_| or
\verb|psb_sort_keep_idx_|; default \verb|psb_sort_ovw_idx_|.
\item[reord] Whether to reorder the input vector $x$ or just return
$IX$ for further usage.\\
Type:{\bf optional}.\\
Specified as: an integer value \verb|psb_sort_reord_x_| or
\verb|psb_sort_noreord_x_|; default \verb|psb_sort_reord_x_|.
\end{description}
\begin{description}
\item[\bf On Return]
\item[x] The sequence of values, in the chosen ordering.\\
\item[x] The sequence of values; if \verb|reord=psb_sort_reord_x_| it
will be in the chosen ordering.\\
Type:{\bf required}.\\
Specified as: an integer, real or complex array of rank 1.
\item[ix] A vector of indices.\\
Type: {\bf Optional} \\
An integer array of rank 1, whose entries are moved to the same
position as the corresponding entries in $x$.
An integer array of rank 1, whose $i$-th entry gives the position of
the (sorted) value of $x$ in the original sequence.
\end{description}
{\goodbreak\par\noindent\large\bfseries Notes}
@@ -1850,7 +1857,10 @@ position as the corresponding entries in $x$.
equal value) in the original input. With the insertion-sort or merge-sort algorithms
ties are preserved in the same relative order as they had in the
original sequence, while this is not guaranteed for quicksort or
heapsort;
heapsort;
\item If $reord=psb\_sort\_noreord\_x\_$, then the input sequence $x$
is not reordered; the output is given in $ix$. Calling without $ix$
in this case is flagged as an error;
\item If $flag = psb\_sort\_ovw\_idx\_$ then the entries in $ix(1:n)$
where $n$ is the size of $x$ are initialized to $ix(i) \leftarrow
i$; thus, upon return from the subroutine, for each