Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

dlaswp.c

Go to the documentation of this file.
00001 /* DLASWP.F -- translated by f2c (version 19941215).
00002    You must link the resulting object file with the libraries:
00003         -lf2c -lm   (in that order)
00004 */
00005 
00006 #include "f2c.h"
00007 
00008 /* Subroutine */ int dlaswp_(n, a, lda, k1, k2, ipiv, incx)
00009 integer *n;
00010 doublereal *a;
00011 integer *lda, *k1, *k2, *ipiv, *incx;
00012 {
00013     /* System generated locals */
00014     integer a_dim1, a_offset, i__1;
00015 
00016     /* Local variables */
00017     static integer i;
00018     extern /* Subroutine */ int dswap_();
00019     static integer ip, ix;
00020 
00021 
00022 /*  -- LAPACK auxiliary routine (version 1.1) -- */
00023 /*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
00024 /*     Courant Institute, Argonne National Lab, and Rice University */
00025 /*     October 31, 1992 */
00026 
00027 /*     .. Scalar Arguments .. */
00028 /*     .. */
00029 /*     .. Array Arguments .. */
00030 /*     .. */
00031 
00032 /*  Purpose */
00033 /*  ======= */
00034 
00035 /*  DLASWP performs a series of row interchanges on the matrix A. */
00036 /*  One row interchange is initiated for each of rows K1 through K2 of A. 
00037 */
00038 
00039 /*  Arguments */
00040 /*  ========= */
00041 
00042 /*  N       (input) INTEGER */
00043 /*          The number of columns of the matrix A. */
00044 
00045 /*  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
00046 /*          On entry, the matrix of column dimension N to which the row */
00047 /*          interchanges will be applied. */
00048 /*          On exit, the permuted matrix. */
00049 
00050 /*  LDA     (input) INTEGER */
00051 /*          The leading dimension of the array A. */
00052 
00053 /*  K1      (input) INTEGER */
00054 /*          The first element of IPIV for which a row interchange will */
00055 /*          be done. */
00056 
00057 /*  K2      (input) INTEGER */
00058 /*          The last element of IPIV for which a row interchange will */
00059 /*          be done. */
00060 
00061 /*  IPIV    (input) INTEGER array, dimension (M*abs(INCX)) */
00062 /*          The vector of pivot indices.  Only the elements in positions 
00063 */
00064 /*          K1 through K2 of IPIV are accessed. */
00065 /*          IPIV(K) = L implies rows K and L are to be interchanged. */
00066 
00067 /*  INCX    (input) INTEGER */
00068 /*          The increment between successive values of IPIV.  If IPIV */
00069 /*          is negative, the pivots are applied in reverse order. */
00070 
00071 /* ===================================================================== 
00072 */
00073 
00074 /*     .. Local Scalars .. */
00075 /*     .. */
00076 /*     .. External Subroutines .. */
00077 /*     .. */
00078 /*     .. Executable Statements .. */
00079 
00080 /*     Interchange row I with row IPIV(I) for each of rows K1 through K2. 
00081 */
00082 
00083     /* Parameter adjustments */
00084     a_dim1 = *lda;
00085     a_offset = a_dim1 + 1;
00086     a -= a_offset;
00087     --ipiv;
00088 
00089     /* Function Body */
00090     if (*incx == 0) {
00091         return 0;
00092     }
00093     if (*incx > 0) {
00094         ix = *k1;
00095     } else {
00096         ix = (1 - *k2) * *incx + 1;
00097     }
00098     if (*incx == 1) {
00099         i__1 = *k2;
00100         for (i = *k1; i <= i__1; ++i) {
00101             ip = ipiv[i];
00102             if (ip != i) {
00103                 dswap_(n, &a[i + a_dim1], lda, &a[ip + a_dim1], lda);
00104             }
00105 /* L10: */
00106         }
00107     } else if (*incx > 1) {
00108         i__1 = *k2;
00109         for (i = *k1; i <= i__1; ++i) {
00110             ip = ipiv[ix];
00111             if (ip != i) {
00112                 dswap_(n, &a[i + a_dim1], lda, &a[ip + a_dim1], lda);
00113             }
00114             ix += *incx;
00115 /* L20: */
00116         }
00117     } else if (*incx < 0) {
00118         i__1 = *k1;
00119         for (i = *k2; i >= i__1; --i) {
00120             ip = ipiv[ix];
00121             if (ip != i) {
00122                 dswap_(n, &a[i + a_dim1], lda, &a[ip + a_dim1], lda);
00123             }
00124             ix += *incx;
00125 /* L30: */
00126         }
00127     }
00128 
00129     return 0;
00130 
00131 /*     End of DLASWP */
00132 
00133 } /* dlaswp_ */
00134 

Generated on Wed Sep 5 12:54:19 2007 for DSACSS Operational Code by  doxygen 1.3.9.1