zlapmt.c
Go to the documentation of this file.
00001 /* zlapmt.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int zlapmt_(logical *forwrd, integer *m, integer *n, 
00017         doublecomplex *x, integer *ldx, integer *k)
00018 {
00019     /* System generated locals */
00020     integer x_dim1, x_offset, i__1, i__2, i__3, i__4;
00021 
00022     /* Local variables */
00023     integer i__, j, ii, in;
00024     doublecomplex temp;
00025 
00026 
00027 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00028 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00029 /*     November 2006 */
00030 
00031 /*     .. Scalar Arguments .. */
00032 /*     .. */
00033 /*     .. Array Arguments .. */
00034 /*     .. */
00035 
00036 /*  Purpose */
00037 /*  ======= */
00038 
00039 /*  ZLAPMT rearranges the columns of the M by N matrix X as specified */
00040 /*  by the permutation K(1),K(2),...,K(N) of the integers 1,...,N. */
00041 /*  If FORWRD = .TRUE.,  forward permutation: */
00042 
00043 /*       X(*,K(J)) is moved X(*,J) for J = 1,2,...,N. */
00044 
00045 /*  If FORWRD = .FALSE., backward permutation: */
00046 
00047 /*       X(*,J) is moved to X(*,K(J)) for J = 1,2,...,N. */
00048 
00049 /*  Arguments */
00050 /*  ========= */
00051 
00052 /*  FORWRD  (input) LOGICAL */
00053 /*          = .TRUE., forward permutation */
00054 /*          = .FALSE., backward permutation */
00055 
00056 /*  M       (input) INTEGER */
00057 /*          The number of rows of the matrix X. M >= 0. */
00058 
00059 /*  N       (input) INTEGER */
00060 /*          The number of columns of the matrix X. N >= 0. */
00061 
00062 /*  X       (input/output) COMPLEX*16 array, dimension (LDX,N) */
00063 /*          On entry, the M by N matrix X. */
00064 /*          On exit, X contains the permuted matrix X. */
00065 
00066 /*  LDX     (input) INTEGER */
00067 /*          The leading dimension of the array X, LDX >= MAX(1,M). */
00068 
00069 /*  K       (input/output) INTEGER array, dimension (N) */
00070 /*          On entry, K contains the permutation vector. K is used as */
00071 /*          internal workspace, but reset to its original value on */
00072 /*          output. */
00073 
00074 /*  ===================================================================== */
00075 
00076 /*     .. Local Scalars .. */
00077 /*     .. */
00078 /*     .. Executable Statements .. */
00079 
00080     /* Parameter adjustments */
00081     x_dim1 = *ldx;
00082     x_offset = 1 + x_dim1;
00083     x -= x_offset;
00084     --k;
00085 
00086     /* Function Body */
00087     if (*n <= 1) {
00088         return 0;
00089     }
00090 
00091     i__1 = *n;
00092     for (i__ = 1; i__ <= i__1; ++i__) {
00093         k[i__] = -k[i__];
00094 /* L10: */
00095     }
00096 
00097     if (*forwrd) {
00098 
00099 /*        Forward permutation */
00100 
00101         i__1 = *n;
00102         for (i__ = 1; i__ <= i__1; ++i__) {
00103 
00104             if (k[i__] > 0) {
00105                 goto L40;
00106             }
00107 
00108             j = i__;
00109             k[j] = -k[j];
00110             in = k[j];
00111 
00112 L20:
00113             if (k[in] > 0) {
00114                 goto L40;
00115             }
00116 
00117             i__2 = *m;
00118             for (ii = 1; ii <= i__2; ++ii) {
00119                 i__3 = ii + j * x_dim1;
00120                 temp.r = x[i__3].r, temp.i = x[i__3].i;
00121                 i__3 = ii + j * x_dim1;
00122                 i__4 = ii + in * x_dim1;
00123                 x[i__3].r = x[i__4].r, x[i__3].i = x[i__4].i;
00124                 i__3 = ii + in * x_dim1;
00125                 x[i__3].r = temp.r, x[i__3].i = temp.i;
00126 /* L30: */
00127             }
00128 
00129             k[in] = -k[in];
00130             j = in;
00131             in = k[in];
00132             goto L20;
00133 
00134 L40:
00135 
00136 /* L50: */
00137             ;
00138         }
00139 
00140     } else {
00141 
00142 /*        Backward permutation */
00143 
00144         i__1 = *n;
00145         for (i__ = 1; i__ <= i__1; ++i__) {
00146 
00147             if (k[i__] > 0) {
00148                 goto L80;
00149             }
00150 
00151             k[i__] = -k[i__];
00152             j = k[i__];
00153 L60:
00154             if (j == i__) {
00155                 goto L80;
00156             }
00157 
00158             i__2 = *m;
00159             for (ii = 1; ii <= i__2; ++ii) {
00160                 i__3 = ii + i__ * x_dim1;
00161                 temp.r = x[i__3].r, temp.i = x[i__3].i;
00162                 i__3 = ii + i__ * x_dim1;
00163                 i__4 = ii + j * x_dim1;
00164                 x[i__3].r = x[i__4].r, x[i__3].i = x[i__4].i;
00165                 i__3 = ii + j * x_dim1;
00166                 x[i__3].r = temp.r, x[i__3].i = temp.i;
00167 /* L70: */
00168             }
00169 
00170             k[j] = -k[j];
00171             j = k[j];
00172             goto L60;
00173 
00174 L80:
00175 
00176 /* L90: */
00177             ;
00178         }
00179 
00180     }
00181 
00182     return 0;
00183 
00184 /*     End of ZLAPMT */
00185 
00186 } /* zlapmt_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:41