1
*> \brief \b DLAMRG 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 DLAMRG + dependencies
10
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlamrg.f">
12
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlamrg.f">
14
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlamrg.f">
21
* SUBROUTINE DLAMRG( N1, N2, A, DTRD1, DTRD2, INDEX )
23
* .. Scalar Arguments ..
24
* INTEGER DTRD1, DTRD2, N1, N2
26
* .. Array Arguments ..
28
* DOUBLE PRECISION A( * )
37
*> DLAMRG 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 arguements contain the respective lengths of the two
54
*> sorted lists to be merged.
59
*> A is DOUBLE PRECISION 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 (DTRDx = 1) or descending
76
*> (DTRDx = -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
95
*> \date September 2012
97
*> \ingroup auxOTHERcomputational
99
* =====================================================================
100
SUBROUTINE DLAMRG( N1, N2, A, DTRD1, DTRD2, INDEX )
102
* -- LAPACK computational routine (version 3.4.2) --
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 DTRD1, DTRD2, N1, N2
110
* .. Array Arguments ..
112
DOUBLE PRECISION A( * )
115
* =====================================================================
117
* .. Local Scalars ..
118
INTEGER I, IND1, IND2, N1SV, N2SV
120
* .. Executable Statements ..
124
IF( DTRD1.GT.0 ) THEN
129
IF( DTRD2.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