1 *> \brief \b SLAMRG creates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLAMRG + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slamrg.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slamrg.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slamrg.f">
21 * SUBROUTINE SLAMRG( N1, N2, A, STRD1, STRD2, INDEX )
23 * .. Scalar Arguments ..
24 * INTEGER N1, N2, STRD1, STRD2
26 * .. Array Arguments ..
37 *> SLAMRG will create a permutation list which will merge the elements
38 *> of A (which is composed of two independently sorted sets) into a
39 *> single set which is sorted in ascending order.
53 *> These arguments contain the respective lengths of the two
54 *> sorted lists to be merged.
59 *> A is REAL array, dimension (N1+N2)
60 *> The first N1 elements of A contain a list of numbers which
61 *> are sorted in either ascending or descending order. Likewise
62 *> for the final N2 elements.
73 *> These are the strides to be taken through the array A.
74 *> Allowable strides are 1 and -1. They indicate whether a
75 *> subset of A is sorted in ascending (STRDx = 1) or descending
76 *> (STRDx = -1) order.
81 *> INDEX is INTEGER array, dimension (N1+N2)
82 *> On exit this array will contain a permutation such that
83 *> if B( I ) = A( INDEX( I ) ) for I=1,N1+N2, then B will be
84 *> sorted in ascending order.
90 *> \author Univ. of Tennessee
91 *> \author Univ. of California Berkeley
92 *> \author Univ. of Colorado Denver
97 *> \ingroup auxOTHERcomputational
99 * =====================================================================
100 SUBROUTINE SLAMRG( N1, N2, A, STRD1, STRD2, INDEX )
102 * -- LAPACK computational routine (version 3.6.1) --
103 * -- LAPACK is a software package provided by Univ. of Tennessee, --
104 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
107 * .. Scalar Arguments ..
108 INTEGER N1, N2, STRD1, STRD2
110 * .. Array Arguments ..
115 * =====================================================================
117 * .. Local Scalars ..
118 INTEGER I, IND1, IND2, N1SV, N2SV
120 * .. Executable Statements ..
124 IF( STRD1.GT.0 ) THEN
129 IF( STRD2.GT.0 ) THEN
135 * while ( (N1SV > 0) & (N2SV > 0) )
137 IF( N1SV.GT.0 .AND. N2SV.GT.0 ) THEN
138 IF( A( IND1 ).LE.A( IND2 ) ) THEN