CXML

srotm, drotm 


FORMAT

  {S,D}ROTM (n, x, incx, y, incy, param)

Arguments

  n                   integer*4
                      On entry, the number of elements in the vectors x and
                      y.
                      On exit, n is unchanged.

  x                   real*4 | real*8
                      On entry, a one-dimensional array X of length at least
                      (1+(n-1)*|incx|), containing the elements of the vector
                      x.
                      On exit, if n<=0 or if PARAM(1) = (-2.0), x is
                      unchanged.  Otherwise, x is overwritten; X contains the
                      rotated vector x.

  incx                integer*4
                      On entry, the increment for the array X.
                      If incx > 0, vector x is stored forward in the array,
                      so that x(i) is stored in location X(1+(i-1)*incx).
                      If incx < 0, vector x is stored backward in the array,
                      so that x(i) is stored in location X(1+(n-i)*|incx|).
                      On exit, incx is unchanged.

  y                   real*4 | real*8
                      On entry, a one-dimensional array Y of length at least
                      (1+(n-1)*|incy|).  Y contains the n elements of the
                      vector y.
                      On exit, if n<=0 or if PARAM(1) = (-2.0), y is
                      unchanged.  Otherwise, y is overwritten; Y contains the
                      rotated vector y.

  incy                integer*4
                      On entry, the increment for the array Y.
                      If incy > 0, vector y is stored forward in the array,
                      so that y(i) is stored in location Y(1+(i-1)*incy).
                      If incy < 0, vector y is stored backward in the array,
                      so that y(i) is stored in location Y(1+(n-i)*|incy|).
                      On exit, incy is unchanged.

  param               real*4 | real*8
                      On entry, an array defining the type of transform
                      matrix H used:

                      PARAM(1) specifies the flag characteristic: -1.0, 0.0,
                      1.0, -2.0

                      PARAM(2) specifies H(11) value

                      PARAM(3) specifies H(21) value

                      PARAM(4) specifies H(12) value

                      PARAM(5) specifies H(22) value
                      On exit, param is unchanged.

Description

  SROTM and DROTM apply a modified Givens transform to each element in the
  pair of real vectors, x and y, using the transformation matrix H as
  follows:

                   |-    -|         |-    -|
                   | x(i) |         | x(i) |
                   |      |   = H * |      |
                   | y(i) |         | y(i) |
                   |_    _|         |_    _|

  Depending on the value of PARAM(1), the transformation matrix is defined as
  follows:

    PARAM(1)= -1.0
       H(11)    H(12)
       H(21)    H(22)

    PARAM(1)= 0.0
         1.0    H(12)
         H(21)    1.0

    PARAM(1)= 1.0
         H(11)    1.0
          -1.0  H(22)

    PARAM(1)= -2.0
           1.0    0.0
           0.0    1.0

  The array PARAM is generated by a call to the routine _ROTMG.

  Results are unpredictable if either incx or incy are zero.

Example

        INTEGER*4 INCA, N
        REAL A(10,10), D(10), SPARAM(5)
  C
        INCA = 10
  C
  C INITIALIZE D TO 1.0
  C
        DO I = 1, 10
           D(I) = 1.0
        END DO
  C
  C FOR EACH ROW OF THE MATRIX, ELIMINATE TO UPPER TRIANGULAR FORM
  C
        DO I = 2, 10
  C
  C ELIMINATE A(I,J) USING ELEMENT A(J,J)
  C
           JEND = I-1
           DO J = 1, JEND
              N = 10-J
              CALL SROTMG(D(J),D(I),A(J,J),A(I,J),SPARAM)
              CALL SROTM(N,A(J,J+1),INCA,A(I,J+1),INCA,SPARAM)
           ENDDO
  C
        END DO
  C
  C APPLY ACCUMULATED SCALE FACTORS TO THE ROWS OF A
  C
        DO I = 1, 10
           CALL SSCAL(11-I, SQRT(D(I)), A(I,I), INCA)
        END DO

  This FORTRAN code shows how to reduce a 10 by 10 matrix to upper triangular
  form using the routine SROTMG and SROTM.

CXML Home Page

Index of CXML Routines