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

drot.c

Go to the documentation of this file.
00001 /* DROT.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 /* DECK DROT */
00010 /* Subroutine */ int __IMPEXP__ drot_(n, dx, incx, dy, incy, dc, ds)
00011 integer *n;
00012 doublereal *dx;
00013 integer *incx;
00014 doublereal *dy;
00015 integer *incy;
00016 doublereal *dc, *ds;
00017 {
00018     /* Initialized data */
00019 
00020     static doublereal zero = 0.;
00021     static doublereal one = 1.;
00022 
00023     /* System generated locals */
00024     integer i__1, i__2;
00025 
00026     /* Local variables */
00027     static integer i;
00028     static doublereal w, z;
00029     static integer kx, ky, nsteps;
00030 
00031 /* ***BEGIN PROLOGUE  DROT */
00032 /* ***DATE WRITTEN   791001   (YYMMDD) */
00033 /* ***REVISION DATE  861211   (YYMMDD) */
00034 /* ***CATEGORY NO.  D1A8 */
00035 /* ***KEYWORDS  LIBRARY=SLATEC(BLAS), */
00036 /*             TYPE=DOUBLE PRECISION(SROT-S DROT-D CSROT-C), */
00037 /*             GIVENS ROTATION,GIVENS TRANSFORMATION,LINEAR ALGEBRA, */
00038 /*             PLANE ROTATION,VECTOR */
00039 /* ***AUTHOR  LAWSON, C. L., (JPL) */
00040 /*           HANSON, R. J., (SNLA) */
00041 /*           KINCAID, D. R., (U. OF TEXAS) */
00042 /*           KROGH, F. T., (JPL) */
00043 /* ***PURPOSE  APPLY d.p. Givens rotation */
00044 /* ***DESCRIPTION */
00045 
00046 /*                B L A S  Subprogram */
00047 /*    Description of Parameters */
00048 
00049 /*     --Input-- */
00050 /*        N  number of elements in input vector(s) */
00051 /*       DX  double precision vector with N elements */
00052 /*     INCX  storage spacing between elements of DX */
00053 /*       DY  double precision vector with N elements */
00054 /*     INCY  storage spacing between elements of DY */
00055 /*       DC  D.P. element of rotation matrix */
00056 /*       DS  D.P. element of rotation matrix */
00057 
00058 /*     --Output-- */
00059 /*       DX  rotated vector (unchanged if N .LE. 0) */
00060 /*       DY  rotated vector (unchanged if N .LE. 0) */
00061 
00062 /*     Multiply the 2 X 2 matrix  ( DC DS) times the 2 X N matrix (DX**T) 
00063 */
00064 /*                                (-DS DC)                        (DY**T) 
00065 */
00066 /*     where **T indicates transpose.  The elements of DX are in */
00067 /*     DX(LX+I*INCX), I = 0 to N-1, where LX = 1 if INCX .GE. 0, else */
00068 /*     LX = (-INCX)*N, and similarly for DY using LY and INCY. */
00069 /* ***REFERENCES  LAWSON C.L., HANSON R.J., KINCAID D.R., KROGH F.T., */
00070 /*                 *BASIC LINEAR ALGEBRA SUBPROGRAMS FOR FORTRAN USAGE*, 
00071 */
00072 /*                 ALGORITHM NO. 539, TRANSACTIONS ON MATHEMATICAL */
00073 /*                 SOFTWARE, VOLUME 5, NUMBER 3, SEPTEMBER 1979, 308-323 
00074 */
00075 /* ***ROUTINES CALLED  (NONE) */
00076 /* ***END PROLOGUE  DROT */
00077 
00078     /* Parameter adjustments */
00079     --dy;
00080     --dx;
00081 
00082     /* Function Body */
00083 /* ***FIRST EXECUTABLE STATEMENT  DROT */
00084     if (*n <= 0 || *ds == zero && *dc == one) {
00085         goto L40;
00086     }
00087     if (! (*incx == *incy && *incx > 0)) {
00088         goto L20;
00089     }
00090 
00091     nsteps = *incx * *n;
00092     i__1 = nsteps;
00093     i__2 = *incx;
00094     for (i = 1; i__2 < 0 ? i >= i__1 : i <= i__1; i += i__2) {
00095         w = dx[i];
00096         z = dy[i];
00097         dx[i] = *dc * w + *ds * z;
00098         dy[i] = -(*ds) * w + *dc * z;
00099 /* L10: */
00100     }
00101     goto L40;
00102 
00103 L20:
00104     kx = 1;
00105     ky = 1;
00106 
00107     if (*incx < 0) {
00108         kx = 1 - (*n - 1) * *incx;
00109     }
00110     if (*incy < 0) {
00111         ky = 1 - (*n - 1) * *incy;
00112     }
00113 
00114     i__2 = *n;
00115     for (i = 1; i <= i__2; ++i) {
00116         w = dx[kx];
00117         z = dy[ky];
00118         dx[kx] = *dc * w + *ds * z;
00119         dy[ky] = -(*ds) * w + *dc * z;
00120         kx += *incx;
00121         ky += *incy;
00122 /* L30: */
00123     }
00124 L40:
00125 
00126     return 0;
00127 } /* drot_ */
00128 

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