LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
dlaswp.f
Go to the documentation of this file.
1 *> \brief \b DLASWP performs a series of row interchanges on a general rectangular matrix.
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download DLASWP + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlaswp.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlaswp.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlaswp.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE DLASWP( N, A, LDA, K1, K2, IPIV, INCX )
22 *
23 * .. Scalar Arguments ..
24 * INTEGER INCX, K1, K2, LDA, N
25 * ..
26 * .. Array Arguments ..
27 * INTEGER IPIV( * )
28 * DOUBLE PRECISION A( LDA, * )
29 * ..
30 *
31 *
32 *> \par Purpose:
33 * =============
34 *>
35 *> \verbatim
36 *>
37 *> DLASWP performs a series of row interchanges on the matrix A.
38 *> One row interchange is initiated for each of rows K1 through K2 of A.
39 *> \endverbatim
40 *
41 * Arguments:
42 * ==========
43 *
44 *> \param[in] N
45 *> \verbatim
46 *> N is INTEGER
47 *> The number of columns of the matrix A.
48 *> \endverbatim
49 *>
50 *> \param[in,out] A
51 *> \verbatim
52 *> A is DOUBLE PRECISION array, dimension (LDA,N)
53 *> On entry, the matrix of column dimension N to which the row
54 *> interchanges will be applied.
55 *> On exit, the permuted matrix.
56 *> \endverbatim
57 *>
58 *> \param[in] LDA
59 *> \verbatim
60 *> LDA is INTEGER
61 *> The leading dimension of the array A.
62 *> \endverbatim
63 *>
64 *> \param[in] K1
65 *> \verbatim
66 *> K1 is INTEGER
67 *> The first element of IPIV for which a row interchange will
68 *> be done.
69 *> \endverbatim
70 *>
71 *> \param[in] K2
72 *> \verbatim
73 *> K2 is INTEGER
74 *> The last element of IPIV for which a row interchange will
75 *> be done.
76 *> \endverbatim
77 *>
78 *> \param[in] IPIV
79 *> \verbatim
80 *> IPIV is INTEGER array, dimension (K2*abs(INCX))
81 *> The vector of pivot indices. Only the elements in positions
82 *> K1 through K2 of IPIV are accessed.
83 *> IPIV(K) = L implies rows K and L are to be interchanged.
84 *> \endverbatim
85 *>
86 *> \param[in] INCX
87 *> \verbatim
88 *> INCX is INTEGER
89 *> The increment between successive values of IPIV. If IPIV
90 *> is negative, the pivots are applied in reverse order.
91 *> \endverbatim
92 *
93 * Authors:
94 * ========
95 *
96 *> \author Univ. of Tennessee
97 *> \author Univ. of California Berkeley
98 *> \author Univ. of Colorado Denver
99 *> \author NAG Ltd.
100 *
101 *> \date September 2012
102 *
103 *> \ingroup doubleOTHERauxiliary
104 *
105 *> \par Further Details:
106 * =====================
107 *>
108 *> \verbatim
109 *>
110 *> Modified by
111 *> R. C. Whaley, Computer Science Dept., Univ. of Tenn., Knoxville, USA
112 *> \endverbatim
113 *>
114 * =====================================================================
115  SUBROUTINE dlaswp( N, A, LDA, K1, K2, IPIV, INCX )
116 *
117 * -- LAPACK auxiliary routine (version 3.4.2) --
118 * -- LAPACK is a software package provided by Univ. of Tennessee, --
119 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120 * September 2012
121 *
122 * .. Scalar Arguments ..
123  INTEGER incx, k1, k2, lda, n
124 * ..
125 * .. Array Arguments ..
126  INTEGER ipiv( * )
127  DOUBLE PRECISION a( lda, * )
128 * ..
129 *
130 * =====================================================================
131 *
132 * .. Local Scalars ..
133  INTEGER i, i1, i2, inc, ip, ix, ix0, j, k, n32
134  DOUBLE PRECISION temp
135 * ..
136 * .. Executable Statements ..
137 *
138 * Interchange row I with row IPIV(I) for each of rows K1 through K2.
139 *
140  IF( incx.GT.0 ) THEN
141  ix0 = k1
142  i1 = k1
143  i2 = k2
144  inc = 1
145  ELSE IF( incx.LT.0 ) THEN
146  ix0 = 1 + ( 1-k2 )*incx
147  i1 = k2
148  i2 = k1
149  inc = -1
150  ELSE
151  return
152  END IF
153 *
154  n32 = ( n / 32 )*32
155  IF( n32.NE.0 ) THEN
156  DO 30 j = 1, n32, 32
157  ix = ix0
158  DO 20 i = i1, i2, inc
159  ip = ipiv( ix )
160  IF( ip.NE.i ) THEN
161  DO 10 k = j, j + 31
162  temp = a( i, k )
163  a( i, k ) = a( ip, k )
164  a( ip, k ) = temp
165  10 continue
166  END IF
167  ix = ix + incx
168  20 continue
169  30 continue
170  END IF
171  IF( n32.NE.n ) THEN
172  n32 = n32 + 1
173  ix = ix0
174  DO 50 i = i1, i2, inc
175  ip = ipiv( ix )
176  IF( ip.NE.i ) THEN
177  DO 40 k = n32, n
178  temp = a( i, k )
179  a( i, k ) = a( ip, k )
180  a( ip, k ) = temp
181  40 continue
182  END IF
183  ix = ix + incx
184  50 continue
185  END IF
186 *
187  return
188 *
189 * End of DLASWP
190 *
191  END