Previous: rt Up: ../eispad.html Next: tinvit


SVD(NM,M,N,A,W,MATU,U,MATV,V,IERR,RV1)

       SUBROUTINE SVD(NM,M,N,A,W,MATU,U,MATV,V,IERR,RV1)
 C
       INTEGER I,J,K,L,M,N,II,I1,KK,K1,LL,L1,MN,NM,ITS,IERR
       DOUBLE PRECISION A(NM,N),W(N),U(NM,N),V(NM,N),RV1(N)
       DOUBLE PRECISION C,F,G,H,S,X,Y,Z,TST1,TST2,SCALE,PYTHAG
       LOGICAL MATU,MATV
 C
 C     THIS SUBROUTINE IS A TRANSLATION OF THE ALGOL PROCEDURE SVD,
 C     NUM. MATH. 14, 403-420(1970) BY GOLUB AND REINSCH.
 C     HANDBOOK FOR AUTO. COMP., VOL II-LINEAR ALGEBRA, 134-151(1971).
 C
 C     THIS SUBROUTINE DETERMINES THE SINGULAR VALUE DECOMPOSITION
 C          T
 C     A=USV  OF A REAL M BY N RECTANGULAR MATRIX.  HOUSEHOLDER
 C     BIDIAGONALIZATION AND A VARIANT OF THE QR ALGORITHM ARE USED.
 C
 C     ON INPUT
 C
 C        NM MUST BE SET TO THE ROW DIMENSION OF TWO-DIMENSIONAL
 C          ARRAY PARAMETERS AS DECLARED IN THE CALLING PROGRAM
 C          DIMENSION STATEMENT.  NOTE THAT NM MUST BE AT LEAST
 C          AS LARGE AS THE MAXIMUM OF M AND N.
 C
 C        M IS THE NUMBER OF ROWS OF A (AND U).
 C
 C        N IS THE NUMBER OF COLUMNS OF A (AND U) AND THE ORDER OF V.
 C
 C        A CONTAINS THE RECTANGULAR INPUT MATRIX TO BE DECOMPOSED.
 C
 C        MATU SHOULD BE SET TO .TRUE. IF THE U MATRIX IN THE
 C          DECOMPOSITION IS DESIRED, AND TO .FALSE. OTHERWISE.
 C
 C        MATV SHOULD BE SET TO .TRUE. IF THE V MATRIX IN THE
 C          DECOMPOSITION IS DESIRED, AND TO .FALSE. OTHERWISE.
 C
 C     ON OUTPUT
 C
 C        A IS UNALTERED (UNLESS OVERWRITTEN BY U OR V).
 C
 C        W CONTAINS THE N (NON-NEGATIVE) SINGULAR VALUES OF A (THE
 C          DIAGONAL ELEMENTS OF S).  THEY ARE UNORDERED.  IF AN
 C          ERROR EXIT IS MADE, THE SINGULAR VALUES SHOULD BE CORRECT
 C          FOR INDICES IERR+1,IERR+2,...,N.
 C
 C        U CONTAINS THE MATRIX U (ORTHOGONAL COLUMN VECTORS) OF THE
 C          DECOMPOSITION IF MATU HAS BEEN SET TO .TRUE.  OTHERWISE
 C          U IS USED AS A TEMPORARY ARRAY.  U MAY COINCIDE WITH A.
 C          IF AN ERROR EXIT IS MADE, THE COLUMNS OF U CORRESPONDING
 C          TO INDICES OF CORRECT SINGULAR VALUES SHOULD BE CORRECT.
 C
 C        V CONTAINS THE MATRIX V (ORTHOGONAL) OF THE DECOMPOSITION IF
 C          MATV HAS BEEN SET TO .TRUE.  OTHERWISE V IS NOT REFERENCED.
 C          V MAY ALSO COINCIDE WITH A IF U IS NOT NEEDED.  IF AN ERROR
 C          EXIT IS MADE, THE COLUMNS OF V CORRESPONDING TO INDICES OF
 C          CORRECT SINGULAR VALUES SHOULD BE CORRECT.
 C
 C        IERR IS SET TO
 C          ZERO       FOR NORMAL RETURN,
 C          K          IF THE K-TH SINGULAR VALUE HAS NOT BEEN
 C                     DETERMINED AFTER 30 ITERATIONS.
 C
 C        RV1 IS A TEMPORARY STORAGE ARRAY.
 C
 C     CALLS PYTHAG FOR  DSQRT(A*A + B*B) .
 C
 C     QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW,
 C     MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY
 C
 C     THIS VERSION DATED AUGUST 1983.
 C
 C     ------------------------------------------------------------------
 C