slargv.c
Go to the documentation of this file.
00001 /* slargv.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 slargv_(integer *n, real *x, integer *incx, real *y, 
00017         integer *incy, real *c__, integer *incc)
00018 {
00019     /* System generated locals */
00020     integer i__1;
00021 
00022     /* Builtin functions */
00023     double sqrt(doublereal);
00024 
00025     /* Local variables */
00026     real f, g;
00027     integer i__;
00028     real t;
00029     integer ic, ix, iy;
00030     real tt;
00031 
00032 
00033 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00034 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00035 /*     November 2006 */
00036 
00037 /*     .. Scalar Arguments .. */
00038 /*     .. */
00039 /*     .. Array Arguments .. */
00040 /*     .. */
00041 
00042 /*  Purpose */
00043 /*  ======= */
00044 
00045 /*  SLARGV generates a vector of real plane rotations, determined by */
00046 /*  elements of the real vectors x and y. For i = 1,2,...,n */
00047 
00048 /*     (  c(i)  s(i) ) ( x(i) ) = ( a(i) ) */
00049 /*     ( -s(i)  c(i) ) ( y(i) ) = (   0  ) */
00050 
00051 /*  Arguments */
00052 /*  ========= */
00053 
00054 /*  N       (input) INTEGER */
00055 /*          The number of plane rotations to be generated. */
00056 
00057 /*  X       (input/output) REAL array, */
00058 /*                         dimension (1+(N-1)*INCX) */
00059 /*          On entry, the vector x. */
00060 /*          On exit, x(i) is overwritten by a(i), for i = 1,...,n. */
00061 
00062 /*  INCX    (input) INTEGER */
00063 /*          The increment between elements of X. INCX > 0. */
00064 
00065 /*  Y       (input/output) REAL array, */
00066 /*                         dimension (1+(N-1)*INCY) */
00067 /*          On entry, the vector y. */
00068 /*          On exit, the sines of the plane rotations. */
00069 
00070 /*  INCY    (input) INTEGER */
00071 /*          The increment between elements of Y. INCY > 0. */
00072 
00073 /*  C       (output) REAL array, dimension (1+(N-1)*INCC) */
00074 /*          The cosines of the plane rotations. */
00075 
00076 /*  INCC    (input) INTEGER */
00077 /*          The increment between elements of C. INCC > 0. */
00078 
00079 /*  ===================================================================== */
00080 
00081 /*     .. Parameters .. */
00082 /*     .. */
00083 /*     .. Local Scalars .. */
00084 /*     .. */
00085 /*     .. Intrinsic Functions .. */
00086 /*     .. */
00087 /*     .. Executable Statements .. */
00088 
00089     /* Parameter adjustments */
00090     --c__;
00091     --y;
00092     --x;
00093 
00094     /* Function Body */
00095     ix = 1;
00096     iy = 1;
00097     ic = 1;
00098     i__1 = *n;
00099     for (i__ = 1; i__ <= i__1; ++i__) {
00100         f = x[ix];
00101         g = y[iy];
00102         if (g == 0.f) {
00103             c__[ic] = 1.f;
00104         } else if (f == 0.f) {
00105             c__[ic] = 0.f;
00106             y[iy] = 1.f;
00107             x[ix] = g;
00108         } else if (dabs(f) > dabs(g)) {
00109             t = g / f;
00110             tt = sqrt(t * t + 1.f);
00111             c__[ic] = 1.f / tt;
00112             y[iy] = t * c__[ic];
00113             x[ix] = f * tt;
00114         } else {
00115             t = f / g;
00116             tt = sqrt(t * t + 1.f);
00117             y[iy] = 1.f / tt;
00118             c__[ic] = t * y[iy];
00119             x[ix] = g * tt;
00120         }
00121         ic += *incc;
00122         iy += *incy;
00123         ix += *incx;
00124 /* L10: */
00125     }
00126     return 0;
00127 
00128 /*     End of SLARGV */
00129 
00130 } /* slargv_ */


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