dlaord.c
Go to the documentation of this file.
00001 /* dlaord.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 dlaord_(char *job, integer *n, doublereal *x, integer *
00017         incx)
00018 {
00019     /* System generated locals */
00020     integer i__1;
00021 
00022     /* Local variables */
00023     integer i__, ix, inc;
00024     doublereal temp;
00025     extern logical lsame_(char *, char *);
00026     integer ixnext;
00027 
00028 
00029 /*  -- LAPACK auxiliary routine (version 3.1) -- */
00030 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00031 /*     November 2006 */
00032 
00033 /*     .. Scalar Arguments .. */
00034 /*     .. */
00035 /*     .. Array Arguments .. */
00036 /*     .. */
00037 
00038 /*  Purpose */
00039 /*  ======= */
00040 
00041 /*  DLAORD sorts the elements of a vector x in increasing or decreasing */
00042 /*  order. */
00043 
00044 /*  Arguments */
00045 /*  ========= */
00046 
00047 /*  JOB     (input) CHARACTER */
00048 /*          = 'I':  Sort in increasing order */
00049 /*          = 'D':  Sort in decreasing order */
00050 
00051 /*  N       (input) INTEGER */
00052 /*          The length of the vector X. */
00053 
00054 /*  X       (input/output) DOUBLE PRECISION array, dimension */
00055 /*                         (1+(N-1)*INCX) */
00056 /*          On entry, the vector of length n to be sorted. */
00057 /*          On exit, the vector x is sorted in the prescribed order. */
00058 
00059 /*  INCX    (input) INTEGER */
00060 /*          The spacing between successive elements of X.  INCX >= 0. */
00061 
00062 /*  ===================================================================== */
00063 
00064 /*     .. Local Scalars .. */
00065 /*     .. */
00066 /*     .. External Functions .. */
00067 /*     .. */
00068 /*     .. Intrinsic Functions .. */
00069 /*     .. */
00070 /*     .. Executable Statements .. */
00071 
00072     /* Parameter adjustments */
00073     --x;
00074 
00075     /* Function Body */
00076     inc = abs(*incx);
00077     if (lsame_(job, "I")) {
00078 
00079 /*        Sort in increasing order */
00080 
00081         i__1 = *n;
00082         for (i__ = 2; i__ <= i__1; ++i__) {
00083             ix = (i__ - 1) * inc + 1;
00084 L10:
00085             if (ix == 1) {
00086                 goto L20;
00087             }
00088             ixnext = ix - inc;
00089             if (x[ix] > x[ixnext]) {
00090                 goto L20;
00091             } else {
00092                 temp = x[ix];
00093                 x[ix] = x[ixnext];
00094                 x[ixnext] = temp;
00095             }
00096             ix = ixnext;
00097             goto L10;
00098 L20:
00099             ;
00100         }
00101 
00102     } else if (lsame_(job, "D")) {
00103 
00104 /*        Sort in decreasing order */
00105 
00106         i__1 = *n;
00107         for (i__ = 2; i__ <= i__1; ++i__) {
00108             ix = (i__ - 1) * inc + 1;
00109 L30:
00110             if (ix == 1) {
00111                 goto L40;
00112             }
00113             ixnext = ix - inc;
00114             if (x[ix] < x[ixnext]) {
00115                 goto L40;
00116             } else {
00117                 temp = x[ix];
00118                 x[ix] = x[ixnext];
00119                 x[ixnext] = temp;
00120             }
00121             ix = ixnext;
00122             goto L30;
00123 L40:
00124             ;
00125         }
00126     }
00127     return 0;
00128 
00129 /*     End of DLAORD */
00130 
00131 } /* dlaord_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:46