⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsyevd.f

📁 网络带宽测试工具
💻 F
📖 第 1 页 / 共 5 页
字号:
**     .. Scalar Arguments ..      INTEGER            CUTPNT, INFO, LDQ, N      Real(l_)   RHO*     ..*     .. Array Arguments ..      INTEGER            INDXQ( * ), IWORK( * )      Real(l_)   D( * ), Q( LDQ, * ), WORK( * )*     ..**  Purpose*  =======**  DLAED1 computes the updated eigensystem of a diagonal*  matrix after modification by a rank-one symmetric matrix.  This*  routine is used only for the eigenproblem which requires all*  eigenvalues and eigenvectors of a tridiagonal matrix.  DLAED7 handles*  the case in which eigenvalues only or eigenvalues and eigenvectors*  of a full symmetric matrix (which was reduced to tridiagonal form)*  are desired.**    T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out)**     where Z = Q'u, u is a vector of length N with ones in the*     CUTPNT and CUTPNT + 1 th elements and zeros elsewhere.**     The eigenvectors of the original matrix are stored in Q, and the*     eigenvalues are in D.  The algorithm consists of three stages:**        The first stage consists of deflating the size of the problem*        when there are multiple eigenvalues or if there is a zero in*        the Z vector.  For each such occurence the dimension of the*        secular equation problem is reduced by one.  This stage is*        performed by the routine DLAED2.**        The second stage consists of calculating the updated*        eigenvalues. This is done by finding the roots of the secular*        equation via the routine DLAED4 (as called by SLAED3).*        This routine also calculates the eigenvectors of the current*        problem.**        The final stage consists of computing the updated eigenvectors*        directly using the updated eigenvalues.  The eigenvectors for*        the current problem are multiplied with the eigenvectors from*        the overall problem.**  Arguments*  =========**  N      (input) INTEGER*         The dimension of the symmetric tridiagonal matrix.  N >= 0.**  D      (input/output) Real(l_) array, dimension (N)*         On entry, the eigenvalues of the rank-1-perturbed matrix.*         On exit, the eigenvalues of the repaired matrix.**  Q      (input/output) Real(l_) array, dimension (LDQ,N)*         On entry, the eigenvectors of the rank-1-perturbed matrix.*         On exit, the eigenvectors of the repaired tridiagonal matrix.**  LDQ    (input) INTEGER*         The leading dimension of the array Q.  LDQ >= max(1,N).**  INDXQ  (input/output) INTEGER array, dimension (N)*         On entry, the permutation which separately sorts the two*         subproblems in D into ascending order.*         On exit, the permutation which will reintegrate the*         subproblems back into sorted order,*         i.e. D( INDXQ( I = 1, N ) ) will be in ascending order.**  RHO    (input) Real(l_)*         The subdiagonal entry used to create the rank-1 modification.**  CUTPNT (input) INTEGER*         The location of the last eigenvalue in the leading sub-matrix.*         min(1,N) <= CUTPNT <= N.**  WORK   (workspace) Real(l_) array, dimension (3*N+2*N**2)**  IWORK  (workspace) INTEGER array, dimension (4*N)**  INFO   (output) INTEGER*          = 0:  successful exit.*          < 0:  if INFO = -i, the i-th argument had an illegal value.*          > 0:  if INFO = 1, an eigenvalue did not converge**  =====================================================================**     .. Local Scalars ..      INTEGER            COLTYP, I, IDLMDA, INDX, INDXC, INDXP, IQ2, IS,     $                   IW, IZ, K, LDQ2, N1, N2, ZPP1*     ..*     .. External Subroutines ..      EXTERNAL           DCOPY, DLAED2, DLAED3, DLAMRG, XERBLA*     ..*     .. Intrinsic Functions ..      INTRINSIC          MAX, MIN*     ..*     .. Executable Statements ..**     Test the input parameters.*      INFO = 0*      IF( N.LT.0 ) THEN         INFO = -1      ELSE IF( LDQ.LT.MAX( 1, N ) ) THEN         INFO = -4      ELSE IF( MIN( 1, N ).GT.CUTPNT .OR. N.LT.CUTPNT ) THEN         INFO = -7      END IF      IF( INFO.NE.0 ) THEN         CALL XERBLA( 'DLAED1', -INFO )         RETURN      END IF**     Quick return if possible*      IF( N.EQ.0 )     $   RETURN**     The following values are for bookkeeping purposes only.  They are*     integer pointers which indicate the portion of the workspace*     used by a particular array in DLAED2 and SLAED3.*      LDQ2 = N*      IZ = 1      IDLMDA = IZ + N      IW = IDLMDA + N      IQ2 = IW + N      IS = IQ2 + N*LDQ2*      INDX = 1      INDXC = INDX + N      COLTYP = INDXC + N      INDXP = COLTYP + N***     Form the z-vector which consists of the last row of Q_1 and the*     first row of Q_2.*      CALL DCOPY( CUTPNT, Q( CUTPNT, 1 ), LDQ, WORK( IZ ), 1 )      ZPP1 = CUTPNT + 1      CALL DCOPY( N-CUTPNT, Q( ZPP1, ZPP1 ), LDQ, WORK( IZ+CUTPNT ), 1 )**     Deflate eigenvalues.*      CALL DLAED2( K, N, D, Q, LDQ, INDXQ, RHO, CUTPNT, WORK( IZ ),     $             WORK( IDLMDA ), WORK( IQ2 ), LDQ2, IWORK( INDXC ),     $             WORK( IW ), IWORK( INDXP ), IWORK( INDX ),     $             IWORK( COLTYP ), INFO )      IF( INFO.NE.0 )     $   GO TO 20**     Solve Secular Equation.*      IF( K.NE.0 ) THEN         CALL DLAED3( K, 1, K, N, D, Q, LDQ, RHO, CUTPNT,     $                WORK( IDLMDA ), WORK( IQ2 ), LDQ2, IWORK( INDXC ),     $                IWORK( COLTYP ), WORK( IW ), WORK( IS ), K, INFO )         IF( INFO.NE.0 )     $      GO TO 20**     Prepare the INDXQ sorting permutation.*         N1 = K         N2 = N - K         CALL DLAMRG( N1, N2, D, 1, -1, INDXQ )      ELSE         DO 10 I = 1, N            INDXQ( I ) = I   10    CONTINUE      END IF*   20 CONTINUE      RETURN**     End of DLAED1*      END! ----------------------------------------------------------------------      SUBROUTINE DLAED2( K, N, D, Q, LDQ, INDXQ, RHO, CUTPNT, Z, DLAMDA,     $                   Q2, LDQ2, INDXC, W, INDXP, INDX, COLTYP, INFO )! ----------------------------------------------------------------------      Use      numerics      Implicit None**  -- LAPACK routine (version 2.0) --*     Univ. of Tennessee, Oak Ridge National Lab, Argonne National Lab,*     Courant Institute, NAG Ltd., and Rice University*     September 30, 1994**     .. Scalar Arguments ..      INTEGER            CUTPNT, INFO, K, LDQ, LDQ2, N      Real(l_)   RHO*     ..*     .. Array Arguments ..      INTEGER            COLTYP( * ), INDX( * ), INDXC( * ), INDXP( * ),     $                   INDXQ( * )      Real(l_)   D( * ), DLAMDA( * ), Q( LDQ, * ),     $                   Q2( LDQ2, * ), W( * ), Z( * )*     ..**  Purpose*  =======**  DLAED2 merges the two sets of eigenvalues together into a single*  sorted set.  Then it tries to deflate the size of the problem.*  There are two ways in which deflation can occur:  when two or more*  eigenvalues are close together or if there is a tiny entry in the*  Z vector.  For each such occurrence the order of the related secular*  equation problem is reduced by one.**  Arguments*  =========**  K      (output) INTEGER*         The number of non-deflated eigenvalues, and the order of the*         related secular equation. 0 <= K <=N.**  N      (input) INTEGER*         The dimension of the symmetric tridiagonal matrix.  N >= 0.**  D      (input/output) Real(l_) array, dimension (N)*         On entry, D contains the eigenvalues of the two submatrices to*         be combined.*         On exit, D contains the trailing (N-K) updated eigenvalues*         (those which were deflated) sorted into increasing order.**  Q      (input/output) Real(l_) array, dimension (LDQ, N)*         On entry, Q contains the eigenvectors of two submatrices in*         the two square blocks with corners at (1,1), (CUTPNT,CUTPNT)*         and (CUTPNT+1, CUTPNT+1), (N,N).*         On exit, Q contains the trailing (N-K) updated eigenvectors*         (those which were deflated) in its last N-K columns.**  LDQ    (input) INTEGER*         The leading dimension of the array Q.  LDQ >= max(1,N).**  INDXQ  (input/output) INTEGER array, dimension (N)*         The permutation which separately sorts the two sub-problems*         in D into ascending order.  Note that elements in the second*         half of this permutation must first have CUTPNT added to their*         values. Destroyed on exit.**  RHO    (input/output) Real(l_)*         On entry, the off-diagonal element associated with the rank-1*         cut which originally split the two submatrices which are now*         being recombined.*         On exit, RHO has been modified to the value required by*         DLAED3.**  CUTPNT (input) INTEGER*         The location of the last eigenvalue in the leading sub-matrix.*         min(1,N) <= CUTPNT <= N.**  Z      (input) Real(l_) array, dimension (N)*         On entry, Z contains the updating vector (the last*         row of the first sub-eigenvector matrix and the first row of*         the second sub-eigenvector matrix).*         On exit, the contents of Z have been destroyed by the updating*         process.**  DLAMDA (output) Real(l_) array, dimension (N)*         A copy of the first K eigenvalues which will be used by*         DLAED3 to form the secular equation.**  Q2     (output) Real(l_) array, dimension (LDQ2, N)*         A copy of the first K eigenvectors which will be used by*         DLAED3 in a matrix multiply (DGEMM) to solve for the new*         eigenvectors.   Q2 is arranged into three blocks.  The*         first block contains non-zero elements only at and above*         CUTPNT, the second contains non-zero elements only below*         CUTPNT, and the third is dense.**  LDQ2   (input) INTEGER*         The leading dimension of the array Q2.  LDQ2 >= max(1,N).**  INDXC  (output) INTEGER array, dimension (N)*         The permutation used to arrange the columns of the deflated*         Q matrix into three groups:  the first group contains non-zero*         elements only at and above CUTPNT, the second contains*         non-zero elements only below CUTPNT, and the third is dense.**  W      (output) Real(l_) array, dimension (N)*         The first k values of the final deflation-altered z-vector*         which will be passed to DLAED3.**  INDXP  (workspace) INTEGER array, dimension (N)*         The permutation used to place deflated values of D at the end*         of the array.  INDXP(1:K) points to the nondeflated D-values*         and INDXP(K+1:N) points to the deflated eigenvalues.**  INDX   (workspace) INTEGER array, dimension (N)*         The permutation used to sort the contents of D into ascending*         order.**  COLTYP (workspace/output) INTEGER array, dimension (N)*         During execution, a label which will indicate which of the*         following types a column in the Q2 matrix is:*         1 : non-zero in the upper half only;*         2 : non-zero in the lower half only;*         3 : dense;*         4 : deflated.*         On exit, COLTYP(i) is the number of columns of type i,*         for i=1 to 4 only.**  INFO   (output) INTEGER*          = 0:  successful exit.*          < 0:  if INFO = -i, the i-th argument had an illegal value.**  =====================================================================**     .. Parameters ..      Real(l_)   MONE, ZERO, ONE, TWO, EIGHT      PARAMETER          ( MONE = -1.0_l_, ZERO = 0.0_l_, ONE = 1.0_l_,     $                   TWO = 2.0_l_, EIGHT = 8.0_l_ )*     ..*     .. Local Arrays ..      INTEGER            CTOT( 4 ), PSM( 4 )*     ..*     .. Local Scalars ..      INTEGER            CT, I, IMAX, J, JLAM, JMAX, JP, K2, N1, N1P1,     $                   N2      Real(l_)   C, EPS, S, T, TAU, TOL*     ..*     .. External Functions ..      INTEGER            IDAMAX      Real(l_)   DLAMCH, DLAPY2      EXTERNAL           IDAMAX, DLAMCH, DLAPY2*     ..*     .. External Subroutines ..      EXTERNAL           DCOPY, DLACPY, DLAMRG, DROT, DSCAL, XERBLA*     ..*     .. Intrinsic Functions ..      INTRINSIC          ABS, MAX, MIN, SQRT*     ..*     .. Executable Statements ..**     Test the input parameters.*      INFO = 0*      IF( N.LT.0 ) THEN         INFO = -2      ELSE IF( LDQ.LT.MAX( 1, N ) ) THEN         INFO = -5      ELSE IF( MIN( 1, N ).GT.CUTPNT .OR. N.LT.CUTPNT ) THEN         INFO = -8      ELSE IF( LDQ2.LT.MAX( 1, N ) ) THEN         INFO = -12      END IF      IF( INFO.NE.0 ) THEN         CALL XERBLA( 'DLAED2', -INFO )         RETURN      END IF**     Quick return if possible*      IF( N.EQ.0 )     $   RETURN*      N1 = CUTPNT      N2 = N - N1      N1P1 = N1 + 1*      IF( RHO.LT.ZERO ) THEN         CALL DSCAL( N2, MONE, Z( N1P1 ), 1 )      END IF**     Normalize z so that norm(z) = 1.  Since z is the concatenation of*     two normalized vectors, norm2(z) = sqrt(2).*      T = ONE / SQRT( TWO )      DO 10 J = 1, N         INDX( J ) = J   10 CONTINUE      CALL DSCAL( N, T, Z, 1 )**     RHO = ABS( norm(z)**2 * RHO )*      RHO = ABS( TWO*RHO )*      DO 20 I = 1, CUTPNT         COLTYP( I ) = 1   20 CONTINUE      DO 30 I = CUTPNT + 1, N         COLTYP( I ) = 2   30 CONTINUE**     Sort the eigenvalues into increasing order*      DO 40 I = CUTPNT + 1, N         INDXQ( I ) = INDXQ( I ) + CUTPNT   40 CONTINUE**     re-integrate the deflated parts from the last pass*      DO 50 I = 1, N         DLAMDA( I ) = D( INDXQ( I ) )         W( I ) = Z( INDXQ( I ) )         INDXC( I ) = COLTYP( INDXQ( I ) )   50 CONTINUE      CALL DLAMRG( N1, N2, DLAMDA, 1, 1, INDX )      DO 60 I = 1, N         D( I ) = DLAMDA( INDX( I ) )         Z( I ) = W( INDX( I ) )         COLTYP( I ) = INDXC( INDX( I ) )   60 CONTINUE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -