comparison ext/clapack/src/dlaswp.c @ 430:335af74a25b6

Merge from branch clapack-included
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 30 Sep 2016 16:24:24 +0100
parents 905e45637745
children
comparison
equal deleted inserted replaced
426:a23b9f8b4a59 430:335af74a25b6
1 /* dlaswp.f -- translated by f2c (version 20061008).
2 You must link the resulting object file with libf2c:
3 on Microsoft Windows system, link with libf2c.lib;
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
5 or, if you install libf2c.a in a standard place, with -lf2c -lm
6 -- in that order, at the end of the command line, as in
7 cc *.o -lf2c -lm
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
9
10 http://www.netlib.org/f2c/libf2c.zip
11 */
12
13 #include "f2c.h"
14 #include "blaswrap.h"
15
16 /* Subroutine */ int dlaswp_(integer *n, doublereal *a, integer *lda, integer
17 *k1, integer *k2, integer *ipiv, integer *incx)
18 {
19 /* System generated locals */
20 integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
21
22 /* Local variables */
23 integer i__, j, k, i1, i2, n32, ip, ix, ix0, inc;
24 doublereal temp;
25
26
27 /* -- LAPACK auxiliary routine (version 3.2) -- */
28 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
29 /* November 2006 */
30
31 /* .. Scalar Arguments .. */
32 /* .. */
33 /* .. Array Arguments .. */
34 /* .. */
35
36 /* Purpose */
37 /* ======= */
38
39 /* DLASWP performs a series of row interchanges on the matrix A. */
40 /* One row interchange is initiated for each of rows K1 through K2 of A. */
41
42 /* Arguments */
43 /* ========= */
44
45 /* N (input) INTEGER */
46 /* The number of columns of the matrix A. */
47
48 /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
49 /* On entry, the matrix of column dimension N to which the row */
50 /* interchanges will be applied. */
51 /* On exit, the permuted matrix. */
52
53 /* LDA (input) INTEGER */
54 /* The leading dimension of the array A. */
55
56 /* K1 (input) INTEGER */
57 /* The first element of IPIV for which a row interchange will */
58 /* be done. */
59
60 /* K2 (input) INTEGER */
61 /* The last element of IPIV for which a row interchange will */
62 /* be done. */
63
64 /* IPIV (input) INTEGER array, dimension (K2*abs(INCX)) */
65 /* The vector of pivot indices. Only the elements in positions */
66 /* K1 through K2 of IPIV are accessed. */
67 /* IPIV(K) = L implies rows K and L are to be interchanged. */
68
69 /* INCX (input) INTEGER */
70 /* The increment between successive values of IPIV. If IPIV */
71 /* is negative, the pivots are applied in reverse order. */
72
73 /* Further Details */
74 /* =============== */
75
76 /* Modified by */
77 /* R. C. Whaley, Computer Science Dept., Univ. of Tenn., Knoxville, USA */
78
79 /* ===================================================================== */
80
81 /* .. Local Scalars .. */
82 /* .. */
83 /* .. Executable Statements .. */
84
85 /* Interchange row I with row IPIV(I) for each of rows K1 through K2. */
86
87 /* Parameter adjustments */
88 a_dim1 = *lda;
89 a_offset = 1 + a_dim1;
90 a -= a_offset;
91 --ipiv;
92
93 /* Function Body */
94 if (*incx > 0) {
95 ix0 = *k1;
96 i1 = *k1;
97 i2 = *k2;
98 inc = 1;
99 } else if (*incx < 0) {
100 ix0 = (1 - *k2) * *incx + 1;
101 i1 = *k2;
102 i2 = *k1;
103 inc = -1;
104 } else {
105 return 0;
106 }
107
108 n32 = *n / 32 << 5;
109 if (n32 != 0) {
110 i__1 = n32;
111 for (j = 1; j <= i__1; j += 32) {
112 ix = ix0;
113 i__2 = i2;
114 i__3 = inc;
115 for (i__ = i1; i__3 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__3)
116 {
117 ip = ipiv[ix];
118 if (ip != i__) {
119 i__4 = j + 31;
120 for (k = j; k <= i__4; ++k) {
121 temp = a[i__ + k * a_dim1];
122 a[i__ + k * a_dim1] = a[ip + k * a_dim1];
123 a[ip + k * a_dim1] = temp;
124 /* L10: */
125 }
126 }
127 ix += *incx;
128 /* L20: */
129 }
130 /* L30: */
131 }
132 }
133 if (n32 != *n) {
134 ++n32;
135 ix = ix0;
136 i__1 = i2;
137 i__3 = inc;
138 for (i__ = i1; i__3 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__3) {
139 ip = ipiv[ix];
140 if (ip != i__) {
141 i__2 = *n;
142 for (k = n32; k <= i__2; ++k) {
143 temp = a[i__ + k * a_dim1];
144 a[i__ + k * a_dim1] = a[ip + k * a_dim1];
145 a[ip + k * a_dim1] = temp;
146 /* L40: */
147 }
148 }
149 ix += *incx;
150 /* L50: */
151 }
152 }
153
154 return 0;
155
156 /* End of DLASWP */
157
158 } /* dlaswp_ */