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

dswap.c

Go to the documentation of this file.
00001 /* DSWAP.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 #include "cblasimpexp.h"
00008 
00009 /* Subroutine */ int __IMPEXP__ dswap_(n, dx, incx, dy, incy)
00010 integer *n;
00011 doublereal *dx;
00012 integer *incx;
00013 doublereal *dy;
00014 integer *incy;
00015 {
00016     /* System generated locals */
00017     integer i__1;
00018 
00019     /* Local variables */
00020     static integer i, m;
00021     static doublereal dtemp;
00022     static integer ix, iy, mp1;
00023 
00024 
00025 /*     interchanges two vectors. */
00026 /*     uses unrolled loops for increments equal one. */
00027 /*     jack dongarra, linpack, 3/11/78. */
00028 
00029 
00030     /* Parameter adjustments */
00031     --dy;
00032     --dx;
00033 
00034     /* Function Body */
00035     if (*n <= 0) {
00036         return 0;
00037     }
00038     if (*incx == 1 && *incy == 1) {
00039         goto L20;
00040     }
00041 
00042 /*       code for unequal increments or equal increments not equal */
00043 /*         to 1 */
00044 
00045     ix = 1;
00046     iy = 1;
00047     if (*incx < 0) {
00048         ix = (-(*n) + 1) * *incx + 1;
00049     }
00050     if (*incy < 0) {
00051         iy = (-(*n) + 1) * *incy + 1;
00052     }
00053     i__1 = *n;
00054     for (i = 1; i <= i__1; ++i) {
00055         dtemp = dx[ix];
00056         dx[ix] = dy[iy];
00057         dy[iy] = dtemp;
00058         ix += *incx;
00059         iy += *incy;
00060 /* L10: */
00061     }
00062     return 0;
00063 
00064 /*       code for both increments equal to 1 */
00065 
00066 
00067 /*       clean-up loop */
00068 
00069 L20:
00070     m = *n % 3;
00071     if (m == 0) {
00072         goto L40;
00073     }
00074     i__1 = m;
00075     for (i = 1; i <= i__1; ++i) {
00076         dtemp = dx[i];
00077         dx[i] = dy[i];
00078         dy[i] = dtemp;
00079 /* L30: */
00080     }
00081     if (*n < 3) {
00082         return 0;
00083     }
00084 L40:
00085     mp1 = m + 1;
00086     i__1 = *n;
00087     for (i = mp1; i <= i__1; i += 3) {
00088         dtemp = dx[i];
00089         dx[i] = dy[i];
00090         dy[i] = dtemp;
00091         dtemp = dx[i + 1];
00092         dx[i + 1] = dy[i + 1];
00093         dy[i + 1] = dtemp;
00094         dtemp = dx[i + 2];
00095         dx[i + 2] = dy[i + 2];
00096         dy[i + 2] = dtemp;
00097 /* L50: */
00098     }
00099     return 0;
00100 } /* dswap_ */
00101 

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