LAPACK 3.3.0

slargv.f

Go to the documentation of this file.
00001       SUBROUTINE SLARGV( N, X, INCX, Y, INCY, C, INCC )
00002 *
00003 *  -- LAPACK auxiliary routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            INCC, INCX, INCY, N
00010 *     ..
00011 *     .. Array Arguments ..
00012       REAL               C( * ), X( * ), Y( * )
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  SLARGV generates a vector of real plane rotations, determined by
00019 *  elements of the real vectors x and y. For i = 1,2,...,n
00020 *
00021 *     (  c(i)  s(i) ) ( x(i) ) = ( a(i) )
00022 *     ( -s(i)  c(i) ) ( y(i) ) = (   0  )
00023 *
00024 *  Arguments
00025 *  =========
00026 *
00027 *  N       (input) INTEGER
00028 *          The number of plane rotations to be generated.
00029 *
00030 *  X       (input/output) REAL array,
00031 *                         dimension (1+(N-1)*INCX)
00032 *          On entry, the vector x.
00033 *          On exit, x(i) is overwritten by a(i), for i = 1,...,n.
00034 *
00035 *  INCX    (input) INTEGER
00036 *          The increment between elements of X. INCX > 0.
00037 *
00038 *  Y       (input/output) REAL array,
00039 *                         dimension (1+(N-1)*INCY)
00040 *          On entry, the vector y.
00041 *          On exit, the sines of the plane rotations.
00042 *
00043 *  INCY    (input) INTEGER
00044 *          The increment between elements of Y. INCY > 0.
00045 *
00046 *  C       (output) REAL array, dimension (1+(N-1)*INCC)
00047 *          The cosines of the plane rotations.
00048 *
00049 *  INCC    (input) INTEGER
00050 *          The increment between elements of C. INCC > 0.
00051 *
00052 *  =====================================================================
00053 *
00054 *     .. Parameters ..
00055       REAL               ZERO, ONE
00056       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00057 *     ..
00058 *     .. Local Scalars ..
00059       INTEGER            I, IC, IX, IY
00060       REAL               F, G, T, TT
00061 *     ..
00062 *     .. Intrinsic Functions ..
00063       INTRINSIC          ABS, SQRT
00064 *     ..
00065 *     .. Executable Statements ..
00066 *
00067       IX = 1
00068       IY = 1
00069       IC = 1
00070       DO 10 I = 1, N
00071          F = X( IX )
00072          G = Y( IY )
00073          IF( G.EQ.ZERO ) THEN
00074             C( IC ) = ONE
00075          ELSE IF( F.EQ.ZERO ) THEN
00076             C( IC ) = ZERO
00077             Y( IY ) = ONE
00078             X( IX ) = G
00079          ELSE IF( ABS( F ).GT.ABS( G ) ) THEN
00080             T = G / F
00081             TT = SQRT( ONE+T*T )
00082             C( IC ) = ONE / TT
00083             Y( IY ) = T*C( IC )
00084             X( IX ) = F*TT
00085          ELSE
00086             T = F / G
00087             TT = SQRT( ONE+T*T )
00088             Y( IY ) = ONE / TT
00089             C( IC ) = T*Y( IY )
00090             X( IX ) = G*TT
00091          END IF
00092          IC = IC + INCC
00093          IY = IY + INCY
00094          IX = IX + INCX
00095    10 CONTINUE
00096       RETURN
00097 *
00098 *     End of SLARGV
00099 *
00100       END
 All Files Functions