The R Project SVN R

Rev

Rev 40292 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 40292 Rev 44673
Line -... Line 1...
-
 
1
      INTEGER          FUNCTION IZMAX1( N, CX, INCX )
-
 
2
*
-
 
3
*  -- LAPACK auxiliary routine (version 3.1) --
-
 
4
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
-
 
5
*     November 2006
-
 
6
*
-
 
7
*     .. Scalar Arguments ..
-
 
8
      INTEGER            INCX, N
-
 
9
*     ..
-
 
10
*     .. Array Arguments ..
-
 
11
      COMPLEX*16         CX( * )
-
 
12
*     ..
-
 
13
*
-
 
14
*  Purpose
-
 
15
*  =======
-
 
16
*
-
 
17
*  IZMAX1 finds the index of the element whose real part has maximum
-
 
18
*  absolute value.
-
 
19
*
-
 
20
*  Based on IZAMAX from Level 1 BLAS.
-
 
21
*  The change is to use the 'genuine' absolute value.
-
 
22
*
-
 
23
*  Contributed by Nick Higham for use with ZLACON.
-
 
24
*
-
 
25
*  Arguments
-
 
26
*  =========
-
 
27
*
-
 
28
*  N       (input) INTEGER
-
 
29
*          The number of elements in the vector CX.
-
 
30
*
-
 
31
*  CX      (input) COMPLEX*16 array, dimension (N)
-
 
32
*          The vector whose elements will be summed.
-
 
33
*
-
 
34
*  INCX    (input) INTEGER
-
 
35
*          The spacing between successive values of CX.  INCX >= 1.
-
 
36
*
-
 
37
* =====================================================================
-
 
38
*
-
 
39
*     .. Local Scalars ..
-
 
40
      INTEGER            I, IX
-
 
41
      DOUBLE PRECISION   SMAX
-
 
42
      COMPLEX*16         ZDUM
-
 
43
*     ..
-
 
44
*     .. Intrinsic Functions ..
-
 
45
      INTRINSIC          ABS
-
 
46
*     ..
-
 
47
*     .. Statement Functions ..
-
 
48
      DOUBLE PRECISION   CABS1
-
 
49
*     ..
-
 
50
*     .. Statement Function definitions ..
-
 
51
*
-
 
52
*     NEXT LINE IS THE ONLY MODIFICATION.
-
 
53
      CABS1( ZDUM ) = ABS( ZDUM )
-
 
54
*     ..
-
 
55
*     .. Executable Statements ..
-
 
56
*
-
 
57
      IZMAX1 = 0
-
 
58
      IF( N.LT.1 )
-
 
59
     $   RETURN
-
 
60
      IZMAX1 = 1
-
 
61
      IF( N.EQ.1 )
-
 
62
     $   RETURN
-
 
63
      IF( INCX.EQ.1 )
-
 
64
     $   GO TO 30
-
 
65
*
-
 
66
*     CODE FOR INCREMENT NOT EQUAL TO 1
-
 
67
*
-
 
68
      IX = 1
-
 
69
      SMAX = CABS1( CX( 1 ) )
-
 
70
      IX = IX + INCX
-
 
71
      DO 20 I = 2, N
-
 
72
         IF( CABS1( CX( IX ) ).LE.SMAX )
-
 
73
     $      GO TO 10
-
 
74
         IZMAX1 = I
-
 
75
         SMAX = CABS1( CX( IX ) )
-
 
76
   10    CONTINUE
-
 
77
         IX = IX + INCX
-
 
78
   20 CONTINUE
-
 
79
      RETURN
-
 
80
*
-
 
81
*     CODE FOR INCREMENT EQUAL TO 1
-
 
82
*
-
 
83
   30 CONTINUE
-
 
84
      SMAX = CABS1( CX( 1 ) )
-
 
85
      DO 40 I = 2, N
-
 
86
         IF( CABS1( CX( I ) ).LE.SMAX )
-
 
87
     $      GO TO 40
-
 
88
         IZMAX1 = I
-
 
89
         SMAX = CABS1( CX( I ) )
-
 
90
   40 CONTINUE
-
 
91
      RETURN
-
 
92
*
-
 
93
*     End of IZMAX1
-
 
94
*
-
 
95
      END
1
      SUBROUTINE ZBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U,
96
      SUBROUTINE ZBDSQR( UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U,
2
     $                   LDU, C, LDC, RWORK, INFO )
97
     $                   LDU, C, LDC, RWORK, INFO )
3
*
98
*
4
*  -- LAPACK routine (version 3.1) --
99
*  -- LAPACK routine (version 3.1) --
5
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
100
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
Line 19... Line 114...
19
*
114
*
20
*  ZBDSQR computes the singular values and, optionally, the right and/or
115
*  ZBDSQR computes the singular values and, optionally, the right and/or
21
*  left singular vectors from the singular value decomposition (SVD) of
116
*  left singular vectors from the singular value decomposition (SVD) of
22
*  a real N-by-N (upper or lower) bidiagonal matrix B using the implicit
117
*  a real N-by-N (upper or lower) bidiagonal matrix B using the implicit
23
*  zero-shift QR algorithm.  The SVD of B has the form
118
*  zero-shift QR algorithm.  The SVD of B has the form
24
* 
119
*
25
*     B = Q * S * P**H
120
*     B = Q * S * P**H
26
* 
121
*
27
*  where S is the diagonal matrix of singular values, Q is an orthogonal
122
*  where S is the diagonal matrix of singular values, Q is an orthogonal
28
*  matrix of left singular vectors, and P is an orthogonal matrix of
123
*  matrix of left singular vectors, and P is an orthogonal matrix of
29
*  right singular vectors.  If left singular vectors are requested, this
124
*  right singular vectors.  If left singular vectors are requested, this
30
*  subroutine actually returns U*Q instead of Q, and, if right singular
125
*  subroutine actually returns U*Q instead of Q, and, if right singular
31
*  vectors are requested, this subroutine returns P**H*VT instead of
126
*  vectors are requested, this subroutine returns P**H*VT instead of
32
*  P**H, for given complex input matrices U and VT.  When U and VT are
127
*  P**H, for given complex input matrices U and VT.  When U and VT are
33
*  the unitary matrices that reduce a general matrix A to bidiagonal
128
*  the unitary matrices that reduce a general matrix A to bidiagonal
34
*  form: A = U*B*VT, as computed by ZGEBRD, then
129
*  form: A = U*B*VT, as computed by ZGEBRD, then
35
* 
130
*
36
*     A = (U*Q) * S * (P**H*VT)
131
*     A = (U*Q) * S * (P**H*VT)
37
* 
132
*
38
*  is the SVD of A.  Optionally, the subroutine may also compute Q**H*C
133
*  is the SVD of A.  Optionally, the subroutine may also compute Q**H*C
39
*  for a given complex input matrix C.
134
*  for a given complex input matrix C.
40
*
135
*
41
*  See "Computing  Small Singular Values of Bidiagonal Matrices With
136
*  See "Computing  Small Singular Values of Bidiagonal Matrices With
42
*  Guaranteed High Relative Accuracy," by J. Demmel and W. Kahan,
137
*  Guaranteed High Relative Accuracy," by J. Demmel and W. Kahan,
Line 738... Line 833...
738
      RETURN
833
      RETURN
739
*
834
*
740
*     End of ZBDSQR
835
*     End of ZBDSQR
741
*
836
*
742
      END
837
      END
-
 
838
      SUBROUTINE ZDRSCL( N, SA, SX, INCX )
-
 
839
*
-
 
840
*  -- LAPACK auxiliary routine (version 3.1) --
-
 
841
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
-
 
842
*     November 2006
-
 
843
*
-
 
844
*     .. Scalar Arguments ..
-
 
845
      INTEGER            INCX, N
-
 
846
      DOUBLE PRECISION   SA
-
 
847
*     ..
-
 
848
*     .. Array Arguments ..
-
 
849
      COMPLEX*16         SX( * )
-
 
850
*     ..
-
 
851
*
-
 
852
*  Purpose
-
 
853
*  =======
-
 
854
*
-
 
855
*  ZDRSCL multiplies an n-element complex vector x by the real scalar
-
 
856
*  1/a.  This is done without overflow or underflow as long as
-
 
857
*  the final result x/a does not overflow or underflow.
-
 
858
*
-
 
859
*  Arguments
-
 
860
*  =========
-
 
861
*
-
 
862
*  N       (input) INTEGER
-
 
863
*          The number of components of the vector x.
-
 
864
*
-
 
865
*  SA      (input) DOUBLE PRECISION
-
 
866
*          The scalar a which is used to divide each component of x.
-
 
867
*          SA must be >= 0, or the subroutine will divide by zero.
-
 
868
*
-
 
869
*  SX      (input/output) COMPLEX*16 array, dimension
-
 
870
*                         (1+(N-1)*abs(INCX))
-
 
871
*          The n-element vector x.
-
 
872
*
-
 
873
*  INCX    (input) INTEGER
-
 
874
*          The increment between successive values of the vector SX.
-
 
875
*          > 0:  SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i),     1< i<= n
-
 
876
*
-
 
877
* =====================================================================
-
 
878
*
-
 
879
*     .. Parameters ..
-
 
880
      DOUBLE PRECISION   ZERO, ONE
-
 
881
      PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
-
 
882
*     ..
-
 
883
*     .. Local Scalars ..
-
 
884
      LOGICAL            DONE
-
 
885
      DOUBLE PRECISION   BIGNUM, CDEN, CDEN1, CNUM, CNUM1, MUL, SMLNUM
-
 
886
*     ..
-
 
887
*     .. External Functions ..
-
 
888
      DOUBLE PRECISION   DLAMCH
-
 
889
      EXTERNAL           DLAMCH
-
 
890
*     ..
-
 
891
*     .. External Subroutines ..
-
 
892
      EXTERNAL           DLABAD, ZDSCAL
-
 
893
*     ..
-
 
894
*     .. Intrinsic Functions ..
-
 
895
      INTRINSIC          ABS
-
 
896
*     ..
-
 
897
*     .. Executable Statements ..
-
 
898
*
-
 
899
*     Quick return if possible
-
 
900
*
-
 
901
      IF( N.LE.0 )
-
 
902
     $   RETURN
-
 
903
*
-
 
904
*     Get machine parameters
-
 
905
*
-
 
906
      SMLNUM = DLAMCH( 'S' )
-
 
907
      BIGNUM = ONE / SMLNUM
-
 
908
      CALL DLABAD( SMLNUM, BIGNUM )
-
 
909
*
-
 
910
*     Initialize the denominator to SA and the numerator to 1.
-
 
911
*
-
 
912
      CDEN = SA
-
 
913
      CNUM = ONE
-
 
914
*
-
 
915
   10 CONTINUE
-
 
916
      CDEN1 = CDEN*SMLNUM
-
 
917
      CNUM1 = CNUM / BIGNUM
-
 
918
      IF( ABS( CDEN1 ).GT.ABS( CNUM ) .AND. CNUM.NE.ZERO ) THEN
-
 
919
*
-
 
920
*        Pre-multiply X by SMLNUM if CDEN is large compared to CNUM.
-
 
921
*
-
 
922
         MUL = SMLNUM
-
 
923
         DONE = .FALSE.
-
 
924
         CDEN = CDEN1
-
 
925
      ELSE IF( ABS( CNUM1 ).GT.ABS( CDEN ) ) THEN
-
 
926
*
-
 
927
*        Pre-multiply X by BIGNUM if CDEN is small compared to CNUM.
-
 
928
*
-
 
929
         MUL = BIGNUM
-
 
930
         DONE = .FALSE.
-
 
931
         CNUM = CNUM1
-
 
932
      ELSE
-
 
933
*
-
 
934
*        Multiply X by CNUM / CDEN and return.
-
 
935
*
-
 
936
         MUL = CNUM / CDEN
-
 
937
         DONE = .TRUE.
-
 
938
      END IF
-
 
939
*
-
 
940
*     Scale the vector X by MUL
-
 
941
*
-
 
942
      CALL ZDSCAL( N, MUL, SX, INCX )
-
 
943
*
-
 
944
      IF( .NOT.DONE )
-
 
945
     $   GO TO 10
-
 
946
*
-
 
947
      RETURN
-
 
948
*
-
 
949
*     End of ZDRSCL
-
 
950
*
-
 
951
      END
743
      SUBROUTINE ZGEBAK( JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV,
952
      SUBROUTINE ZGEBAK( JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV,
744
     $                   INFO )
953
     $                   INFO )
745
*
954
*
746
*  -- LAPACK routine (version 3.1) --
955
*  -- LAPACK routine (version 3.1) --
747
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
956
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
Line 1775... Line 1984...
1775
      RETURN
1984
      RETURN
1776
*
1985
*
1777
*     End of ZGEBRD
1986
*     End of ZGEBRD
1778
*
1987
*
1779
      END
1988
      END
-
 
1989
      SUBROUTINE ZGECON( NORM, N, A, LDA, ANORM, RCOND, WORK, RWORK,
-
 
1990
     $                   INFO )
-
 
1991
*
-
 
1992
*  -- LAPACK routine (version 3.1) --
-
 
1993
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
-
 
1994
*     November 2006
-
 
1995
*
-
 
1996
*     Modified to call ZLACN2 in place of ZLACON, 10 Feb 03, SJH.
-
 
1997
*
-
 
1998
*     .. Scalar Arguments ..
-
 
1999
      CHARACTER          NORM
-
 
2000
      INTEGER            INFO, LDA, N
-
 
2001
      DOUBLE PRECISION   ANORM, RCOND
-
 
2002
*     ..
-
 
2003
*     .. Array Arguments ..
-
 
2004
      DOUBLE PRECISION   RWORK( * )
-
 
2005
      COMPLEX*16         A( LDA, * ), WORK( * )
-
 
2006
*     ..
-
 
2007
*
-
 
2008
*  Purpose
-
 
2009
*  =======
-
 
2010
*
-
 
2011
*  ZGECON estimates the reciprocal of the condition number of a general
-
 
2012
*  complex matrix A, in either the 1-norm or the infinity-norm, using
-
 
2013
*  the LU factorization computed by ZGETRF.
-
 
2014
*
-
 
2015
*  An estimate is obtained for norm(inv(A)), and the reciprocal of the
-
 
2016
*  condition number is computed as
-
 
2017
*     RCOND = 1 / ( norm(A) * norm(inv(A)) ).
-
 
2018
*
-
 
2019
*  Arguments
-
 
2020
*  =========
-
 
2021
*
-
 
2022
*  NORM    (input) CHARACTER*1
-
 
2023
*          Specifies whether the 1-norm condition number or the
-
 
2024
*          infinity-norm condition number is required:
-
 
2025
*          = '1' or 'O':  1-norm;
-
 
2026
*          = 'I':         Infinity-norm.
-
 
2027
*
-
 
2028
*  N       (input) INTEGER
-
 
2029
*          The order of the matrix A.  N >= 0.
-
 
2030
*
-
 
2031
*  A       (input) COMPLEX*16 array, dimension (LDA,N)
-
 
2032
*          The factors L and U from the factorization A = P*L*U
-
 
2033
*          as computed by ZGETRF.
-
 
2034
*
-
 
2035
*  LDA     (input) INTEGER
-
 
2036
*          The leading dimension of the array A.  LDA >= max(1,N).
-
 
2037
*
-
 
2038
*  ANORM   (input) DOUBLE PRECISION
-
 
2039
*          If NORM = '1' or 'O', the 1-norm of the original matrix A.
-
 
2040
*          If NORM = 'I', the infinity-norm of the original matrix A.
-
 
2041
*
-
 
2042
*  RCOND   (output) DOUBLE PRECISION
-
 
2043
*          The reciprocal of the condition number of the matrix A,
-
 
2044
*          computed as RCOND = 1/(norm(A) * norm(inv(A))).
-
 
2045
*
-
 
2046
*  WORK    (workspace) COMPLEX*16 array, dimension (2*N)
-
 
2047
*
-
 
2048
*  RWORK   (workspace) DOUBLE PRECISION array, dimension (2*N)
-
 
2049
*
-
 
2050
*  INFO    (output) INTEGER
-
 
2051
*          = 0:  successful exit
-
 
2052
*          < 0:  if INFO = -i, the i-th argument had an illegal value
-
 
2053
*
-
 
2054
*  =====================================================================
-
 
2055
*
-
 
2056
*     .. Parameters ..
-
 
2057
      DOUBLE PRECISION   ONE, ZERO
-
 
2058
      PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
-
 
2059
*     ..
-
 
2060
*     .. Local Scalars ..
-
 
2061
      LOGICAL            ONENRM
-
 
2062
      CHARACTER          NORMIN
-
 
2063
      INTEGER            IX, KASE, KASE1
-
 
2064
      DOUBLE PRECISION   AINVNM, SCALE, SL, SMLNUM, SU
-
 
2065
      COMPLEX*16         ZDUM
-
 
2066
*     ..
-
 
2067
*     .. Local Arrays ..
-
 
2068
      INTEGER            ISAVE( 3 )
-
 
2069
*     ..
-
 
2070
*     .. External Functions ..
-
 
2071
      LOGICAL            LSAME
-
 
2072
      INTEGER            IZAMAX
-
 
2073
      DOUBLE PRECISION   DLAMCH
-
 
2074
      EXTERNAL           LSAME, IZAMAX, DLAMCH
-
 
2075
*     ..
-
 
2076
*     .. External Subroutines ..
-
 
2077
      EXTERNAL           XERBLA, ZDRSCL, ZLACN2, ZLATRS
-
 
2078
*     ..
-
 
2079
*     .. Intrinsic Functions ..
-
 
2080
      INTRINSIC          ABS, DBLE, DIMAG, MAX
-
 
2081
*     ..
-
 
2082
*     .. Statement Functions ..
-
 
2083
      DOUBLE PRECISION   CABS1
-
 
2084
*     ..
-
 
2085
*     .. Statement Function definitions ..
-
 
2086
      CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
-
 
2087
*     ..
-
 
2088
*     .. Executable Statements ..
-
 
2089
*
-
 
2090
*     Test the input parameters.
-
 
2091
*
-
 
2092
      INFO = 0
-
 
2093
      ONENRM = NORM.EQ.'1' .OR. LSAME( NORM, 'O' )
-
 
2094
      IF( .NOT.ONENRM .AND. .NOT.LSAME( NORM, 'I' ) ) THEN
-
 
2095
         INFO = -1
-
 
2096
      ELSE IF( N.LT.0 ) THEN
-
 
2097
         INFO = -2
-
 
2098
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
-
 
2099
         INFO = -4
-
 
2100
      ELSE IF( ANORM.LT.ZERO ) THEN
-
 
2101
         INFO = -5
-
 
2102
      END IF
-
 
2103
      IF( INFO.NE.0 ) THEN
-
 
2104
         CALL XERBLA( 'ZGECON', -INFO )
-
 
2105
         RETURN
-
 
2106
      END IF
-
 
2107
*
-
 
2108
*     Quick return if possible
-
 
2109
*
-
 
2110
      RCOND = ZERO
-
 
2111
      IF( N.EQ.0 ) THEN
-
 
2112
         RCOND = ONE
-
 
2113
         RETURN
-
 
2114
      ELSE IF( ANORM.EQ.ZERO ) THEN
-
 
2115
         RETURN
-
 
2116
      END IF
-
 
2117
*
-
 
2118
      SMLNUM = DLAMCH( 'Safe minimum' )
-
 
2119
*
-
 
2120
*     Estimate the norm of inv(A).
-
 
2121
*
-
 
2122
      AINVNM = ZERO
-
 
2123
      NORMIN = 'N'
-
 
2124
      IF( ONENRM ) THEN
-
 
2125
         KASE1 = 1
-
 
2126
      ELSE
-
 
2127
         KASE1 = 2
-
 
2128
      END IF
-
 
2129
      KASE = 0
-
 
2130
   10 CONTINUE
-
 
2131
      CALL ZLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
-
 
2132
      IF( KASE.NE.0 ) THEN
-
 
2133
         IF( KASE.EQ.KASE1 ) THEN
-
 
2134
*
-
 
2135
*           Multiply by inv(L).
-
 
2136
*
-
 
2137
            CALL ZLATRS( 'Lower', 'No transpose', 'Unit', NORMIN, N, A,
-
 
2138
     $                   LDA, WORK, SL, RWORK, INFO )
-
 
2139
*
-
 
2140
*           Multiply by inv(U).
-
 
2141
*
-
 
2142
            CALL ZLATRS( 'Upper', 'No transpose', 'Non-unit', NORMIN, N,
-
 
2143
     $                   A, LDA, WORK, SU, RWORK( N+1 ), INFO )
-
 
2144
         ELSE
-
 
2145
*
-
 
2146
*           Multiply by inv(U').
-
 
2147
*
-
 
2148
            CALL ZLATRS( 'Upper', 'Conjugate transpose', 'Non-unit',
-
 
2149
     $                   NORMIN, N, A, LDA, WORK, SU, RWORK( N+1 ),
-
 
2150
     $                   INFO )
-
 
2151
*
-
 
2152
*           Multiply by inv(L').
-
 
2153
*
-
 
2154
            CALL ZLATRS( 'Lower', 'Conjugate transpose', 'Unit', NORMIN,
-
 
2155
     $                   N, A, LDA, WORK, SL, RWORK, INFO )
-
 
2156
         END IF
-
 
2157
*
-
 
2158
*        Divide X by 1/(SL*SU) if doing so will not cause overflow.
-
 
2159
*
-
 
2160
         SCALE = SL*SU
-
 
2161
         NORMIN = 'Y'
-
 
2162
         IF( SCALE.NE.ONE ) THEN
-
 
2163
            IX = IZAMAX( N, WORK, 1 )
-
 
2164
            IF( SCALE.LT.CABS1( WORK( IX ) )*SMLNUM .OR. SCALE.EQ.ZERO )
-
 
2165
     $         GO TO 20
-
 
2166
            CALL ZDRSCL( N, SCALE, WORK, 1 )
-
 
2167
         END IF
-
 
2168
         GO TO 10
-
 
2169
      END IF
-
 
2170
*
-
 
2171
*     Compute the estimate of the reciprocal condition number.
-
 
2172
*
-
 
2173
      IF( AINVNM.NE.ZERO )
-
 
2174
     $   RCOND = ( ONE / AINVNM ) / ANORM
-
 
2175
*
-
 
2176
   20 CONTINUE
-
 
2177
      RETURN
-
 
2178
*
-
 
2179
*     End of ZGECON
-
 
2180
*
-
 
2181
      END
1780
      SUBROUTINE ZGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR,
2182
      SUBROUTINE ZGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR,
1781
     $                  WORK, LWORK, RWORK, INFO )
2183
     $                  WORK, LWORK, RWORK, INFO )
1782
*
2184
*
1783
*  -- LAPACK driver routine (version 3.1) --
2185
*  -- LAPACK driver routine (version 3.1) --
1784
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
2186
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
Line 2420... Line 2822...
2420
*  modified element of the upper Hessenberg matrix H, and vi denotes an
2822
*  modified element of the upper Hessenberg matrix H, and vi denotes an
2421
*  element of the vector defining H(i).
2823
*  element of the vector defining H(i).
2422
*
2824
*
2423
*  This file is a slight modification of LAPACK-3.0's ZGEHRD
2825
*  This file is a slight modification of LAPACK-3.0's ZGEHRD
2424
*  subroutine incorporating improvements proposed by Quintana-Orti and
2826
*  subroutine incorporating improvements proposed by Quintana-Orti and
2425
*  Van de Geijn (2005). 
2827
*  Van de Geijn (2005).
2426
*
2828
*
2427
*  =====================================================================
2829
*  =====================================================================
2428
*
2830
*
2429
*     .. Parameters ..
2831
*     .. Parameters ..
2430
      INTEGER            NBMAX, LDT
2832
      INTEGER            NBMAX, LDT
2431
      PARAMETER          ( NBMAX = 64, LDT = NBMAX+1 )
2833
      PARAMETER          ( NBMAX = 64, LDT = NBMAX+1 )
2432
      COMPLEX*16        ZERO, ONE
2834
      COMPLEX*16        ZERO, ONE
2433
      PARAMETER          ( ZERO = ( 0.0D+0, 0.0D+0 ), 
2835
      PARAMETER          ( ZERO = ( 0.0D+0, 0.0D+0 ),
2434
     $                     ONE = ( 1.0D+0, 0.0D+0 ) )
2836
     $                     ONE = ( 1.0D+0, 0.0D+0 ) )
2435
*     ..
2837
*     ..
2436
*     .. Local Scalars ..
2838
*     .. Local Scalars ..
2437
      LOGICAL            LQUERY
2839
      LOGICAL            LQUERY
2438
      INTEGER            I, IB, IINFO, IWS, J, LDWORK, LWKOPT, NB,
2840
      INTEGER            I, IB, IINFO, IWS, J, LDWORK, LWKOPT, NB,
Line 2555... Line 2957...
2555
*           right, computing  A := A - Y * V'. V(i+ib,ib-1) must be set
2957
*           right, computing  A := A - Y * V'. V(i+ib,ib-1) must be set
2556
*           to 1
2958
*           to 1
2557
*
2959
*
2558
            EI = A( I+IB, I+IB-1 )
2960
            EI = A( I+IB, I+IB-1 )
2559
            A( I+IB, I+IB-1 ) = ONE
2961
            A( I+IB, I+IB-1 ) = ONE
2560
            CALL ZGEMM( 'No transpose', 'Conjugate transpose', 
2962
            CALL ZGEMM( 'No transpose', 'Conjugate transpose',
2561
     $                  IHI, IHI-I-IB+1,
2963
     $                  IHI, IHI-I-IB+1,
2562
     $                  IB, -ONE, WORK, LDWORK, A( I+IB, I ), LDA, ONE,
2964
     $                  IB, -ONE, WORK, LDWORK, A( I+IB, I ), LDA, ONE,
2563
     $                  A( 1, I+IB ), LDA )
2965
     $                  A( 1, I+IB ), LDA )
2564
            A( I+IB, I+IB-1 ) = EI
2966
            A( I+IB, I+IB-1 ) = EI
2565
*
2967
*
Line 7332... Line 7734...
7332
      IF( M.EQ.0 .OR. N.EQ.0 )
7734
      IF( M.EQ.0 .OR. N.EQ.0 )
7333
     $   RETURN
7735
     $   RETURN
7334
*
7736
*
7335
*     Compute machine safe minimum
7737
*     Compute machine safe minimum
7336
*
7738
*
7337
      SFMIN = DLAMCH('S') 
7739
      SFMIN = DLAMCH('S')
7338
*
7740
*
7339
      DO 10 J = 1, MIN( M, N )
7741
      DO 10 J = 1, MIN( M, N )
7340
*
7742
*
7341
*        Find pivot and test for singularity.
7743
*        Find pivot and test for singularity.
7342
*
7744
*
Line 8641... Line 9043...
8641
*                         150              590          NS =  **
9043
*                         150              590          NS =  **
8642
*                         590             3000          NS =  64
9044
*                         590             3000          NS =  64
8643
*                        3000             6000          NS = 128
9045
*                        3000             6000          NS = 128
8644
*                        6000             infinity      NS = 256
9046
*                        6000             infinity      NS = 256
8645
*
9047
*
8646
*                  (+)  By default some or all matrices of this order 
9048
*                  (+)  By default some or all matrices of this order
8647
*                       are passed to the implicit double shift routine
9049
*                       are passed to the implicit double shift routine
8648
*                       ZLAHQR and NS is ignored.  See ISPEC=1 above 
9050
*                       ZLAHQR and NS is ignored.  See ISPEC=1 above
8649
*                       and comments in IPARM for details.
9051
*                       and comments in IPARM for details.
8650
*
9052
*
8651
*                       The asterisks (**) indicate an ad-hoc
9053
*                       The asterisks (**) indicate an ad-hoc
8652
*                       function of N increasing from 10 to 64.
9054
*                       function of N increasing from 10 to 64.
8653
*
9055
*
Line 9240... Line 9642...
9240
      RETURN
9642
      RETURN
9241
*
9643
*
9242
*     End of ZLACGV
9644
*     End of ZLACGV
9243
*
9645
*
9244
      END
9646
      END
-
 
9647
      SUBROUTINE ZLACN2( N, V, X, EST, KASE, ISAVE )
-
 
9648
*
-
 
9649
*  -- LAPACK auxiliary routine (version 3.1) --
-
 
9650
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
-
 
9651
*     November 2006
-
 
9652
*
-
 
9653
*     .. Scalar Arguments ..
-
 
9654
      INTEGER            KASE, N
-
 
9655
      DOUBLE PRECISION   EST
-
 
9656
*     ..
-
 
9657
*     .. Array Arguments ..
-
 
9658
      INTEGER            ISAVE( 3 )
-
 
9659
      COMPLEX*16         V( * ), X( * )
-
 
9660
*     ..
-
 
9661
*
-
 
9662
*  Purpose
-
 
9663
*  =======
-
 
9664
*
-
 
9665
*  ZLACN2 estimates the 1-norm of a square, complex matrix A.
-
 
9666
*  Reverse communication is used for evaluating matrix-vector products.
-
 
9667
*
-
 
9668
*  Arguments
-
 
9669
*  =========
-
 
9670
*
-
 
9671
*  N      (input) INTEGER
-
 
9672
*         The order of the matrix.  N >= 1.
-
 
9673
*
-
 
9674
*  V      (workspace) COMPLEX*16 array, dimension (N)
-
 
9675
*         On the final return, V = A*W,  where  EST = norm(V)/norm(W)
-
 
9676
*         (W is not returned).
-
 
9677
*
-
 
9678
*  X      (input/output) COMPLEX*16 array, dimension (N)
-
 
9679
*         On an intermediate return, X should be overwritten by
-
 
9680
*               A * X,   if KASE=1,
-
 
9681
*               A' * X,  if KASE=2,
-
 
9682
*         where A' is the conjugate transpose of A, and ZLACN2 must be
-
 
9683
*         re-called with all the other parameters unchanged.
-
 
9684
*
-
 
9685
*  EST    (input/output) DOUBLE PRECISION
-
 
9686
*         On entry with KASE = 1 or 2 and ISAVE(1) = 3, EST should be
-
 
9687
*         unchanged from the previous call to ZLACN2.
-
 
9688
*         On exit, EST is an estimate (a lower bound) for norm(A).
-
 
9689
*
-
 
9690
*  KASE   (input/output) INTEGER
-
 
9691
*         On the initial call to ZLACN2, KASE should be 0.
-
 
9692
*         On an intermediate return, KASE will be 1 or 2, indicating
-
 
9693
*         whether X should be overwritten by A * X  or A' * X.
-
 
9694
*         On the final return from ZLACN2, KASE will again be 0.
-
 
9695
*
-
 
9696
*  ISAVE  (input/output) INTEGER array, dimension (3)
-
 
9697
*         ISAVE is used to save variables between calls to ZLACN2
-
 
9698
*
-
 
9699
*  Further Details
-
 
9700
*  ======= =======
-
 
9701
*
-
 
9702
*  Contributed by Nick Higham, University of Manchester.
-
 
9703
*  Originally named CONEST, dated March 16, 1988.
-
 
9704
*
-
 
9705
*  Reference: N.J. Higham, "FORTRAN codes for estimating the one-norm of
-
 
9706
*  a real or complex matrix, with applications to condition estimation",
-
 
9707
*  ACM Trans. Math. Soft., vol. 14, no. 4, pp. 381-396, December 1988.
-
 
9708
*
-
 
9709
*  Last modified:  April, 1999
-
 
9710
*
-
 
9711
*  This is a thread safe version of ZLACON, which uses the array ISAVE
-
 
9712
*  in place of a SAVE statement, as follows:
-
 
9713
*
-
 
9714
*     ZLACON     ZLACN2
-
 
9715
*      JUMP     ISAVE(1)
-
 
9716
*      J        ISAVE(2)
-
 
9717
*      ITER     ISAVE(3)
-
 
9718
*
-
 
9719
*  =====================================================================
-
 
9720
*
-
 
9721
*     .. Parameters ..
-
 
9722
      INTEGER              ITMAX
-
 
9723
      PARAMETER          ( ITMAX = 5 )
-
 
9724
      DOUBLE PRECISION     ONE,         TWO
-
 
9725
      PARAMETER          ( ONE = 1.0D0, TWO = 2.0D0 )
-
 
9726
      COMPLEX*16           CZERO, CONE
-
 
9727
      PARAMETER          ( CZERO = ( 0.0D0, 0.0D0 ),
-
 
9728
     $                            CONE = ( 1.0D0, 0.0D0 ) )
-
 
9729
*     ..
-
 
9730
*     .. Local Scalars ..
-
 
9731
      INTEGER            I, JLAST
-
 
9732
      DOUBLE PRECISION   ABSXI, ALTSGN, ESTOLD, SAFMIN, TEMP
-
 
9733
*     ..
-
 
9734
*     .. External Functions ..
-
 
9735
      INTEGER            IZMAX1
-
 
9736
      DOUBLE PRECISION   DLAMCH, DZSUM1
-
 
9737
      EXTERNAL           IZMAX1, DLAMCH, DZSUM1
-
 
9738
*     ..
-
 
9739
*     .. External Subroutines ..
-
 
9740
      EXTERNAL           ZCOPY
-
 
9741
*     ..
-
 
9742
*     .. Intrinsic Functions ..
-
 
9743
      INTRINSIC          ABS, DBLE, DCMPLX, DIMAG
-
 
9744
*     ..
-
 
9745
*     .. Executable Statements ..
-
 
9746
*
-
 
9747
      SAFMIN = DLAMCH( 'Safe minimum' )
-
 
9748
      IF( KASE.EQ.0 ) THEN
-
 
9749
         DO 10 I = 1, N
-
 
9750
            X( I ) = DCMPLX( ONE / DBLE( N ) )
-
 
9751
   10    CONTINUE
-
 
9752
         KASE = 1
-
 
9753
         ISAVE( 1 ) = 1
-
 
9754
         RETURN
-
 
9755
      END IF
-
 
9756
*
-
 
9757
      GO TO ( 20, 40, 70, 90, 120 )ISAVE( 1 )
-
 
9758
*
-
 
9759
*     ................ ENTRY   (ISAVE( 1 ) = 1)
-
 
9760
*     FIRST ITERATION.  X HAS BEEN OVERWRITTEN BY A*X.
-
 
9761
*
-
 
9762
   20 CONTINUE
-
 
9763
      IF( N.EQ.1 ) THEN
-
 
9764
         V( 1 ) = X( 1 )
-
 
9765
         EST = ABS( V( 1 ) )
-
 
9766
*        ... QUIT
-
 
9767
         GO TO 130
-
 
9768
      END IF
-
 
9769
      EST = DZSUM1( N, X, 1 )
-
 
9770
*
-
 
9771
      DO 30 I = 1, N
-
 
9772
         ABSXI = ABS( X( I ) )
-
 
9773
         IF( ABSXI.GT.SAFMIN ) THEN
-
 
9774
            X( I ) = DCMPLX( DBLE( X( I ) ) / ABSXI,
-
 
9775
     $               DIMAG( X( I ) ) / ABSXI )
-
 
9776
         ELSE
-
 
9777
            X( I ) = CONE
-
 
9778
         END IF
-
 
9779
   30 CONTINUE
-
 
9780
      KASE = 2
-
 
9781
      ISAVE( 1 ) = 2
-
 
9782
      RETURN
-
 
9783
*
-
 
9784
*     ................ ENTRY   (ISAVE( 1 ) = 2)
-
 
9785
*     FIRST ITERATION.  X HAS BEEN OVERWRITTEN BY CTRANS(A)*X.
-
 
9786
*
-
 
9787
   40 CONTINUE
-
 
9788
      ISAVE( 2 ) = IZMAX1( N, X, 1 )
-
 
9789
      ISAVE( 3 ) = 2
-
 
9790
*
-
 
9791
*     MAIN LOOP - ITERATIONS 2,3,...,ITMAX.
-
 
9792
*
-
 
9793
   50 CONTINUE
-
 
9794
      DO 60 I = 1, N
-
 
9795
         X( I ) = CZERO
-
 
9796
   60 CONTINUE
-
 
9797
      X( ISAVE( 2 ) ) = CONE
-
 
9798
      KASE = 1
-
 
9799
      ISAVE( 1 ) = 3
-
 
9800
      RETURN
-
 
9801
*
-
 
9802
*     ................ ENTRY   (ISAVE( 1 ) = 3)
-
 
9803
*     X HAS BEEN OVERWRITTEN BY A*X.
-
 
9804
*
-
 
9805
   70 CONTINUE
-
 
9806
      CALL ZCOPY( N, X, 1, V, 1 )
-
 
9807
      ESTOLD = EST
-
 
9808
      EST = DZSUM1( N, V, 1 )
-
 
9809
*
-
 
9810
*     TEST FOR CYCLING.
-
 
9811
      IF( EST.LE.ESTOLD )
-
 
9812
     $   GO TO 100
-
 
9813
*
-
 
9814
      DO 80 I = 1, N
-
 
9815
         ABSXI = ABS( X( I ) )
-
 
9816
         IF( ABSXI.GT.SAFMIN ) THEN
-
 
9817
            X( I ) = DCMPLX( DBLE( X( I ) ) / ABSXI,
-
 
9818
     $               DIMAG( X( I ) ) / ABSXI )
-
 
9819
         ELSE
-
 
9820
            X( I ) = CONE
-
 
9821
         END IF
-
 
9822
   80 CONTINUE
-
 
9823
      KASE = 2
-
 
9824
      ISAVE( 1 ) = 4
-
 
9825
      RETURN
-
 
9826
*
-
 
9827
*     ................ ENTRY   (ISAVE( 1 ) = 4)
-
 
9828
*     X HAS BEEN OVERWRITTEN BY CTRANS(A)*X.
-
 
9829
*
-
 
9830
   90 CONTINUE
-
 
9831
      JLAST = ISAVE( 2 )
-
 
9832
      ISAVE( 2 ) = IZMAX1( N, X, 1 )
-
 
9833
      IF( ( ABS( X( JLAST ) ).NE.ABS( X( ISAVE( 2 ) ) ) ) .AND.
-
 
9834
     $    ( ISAVE( 3 ).LT.ITMAX ) ) THEN
-
 
9835
         ISAVE( 3 ) = ISAVE( 3 ) + 1
-
 
9836
         GO TO 50
-
 
9837
      END IF
-
 
9838
*
-
 
9839
*     ITERATION COMPLETE.  FINAL STAGE.
-
 
9840
*
-
 
9841
  100 CONTINUE
-
 
9842
      ALTSGN = ONE
-
 
9843
      DO 110 I = 1, N
-
 
9844
         X( I ) = DCMPLX( ALTSGN*( ONE+DBLE( I-1 ) / DBLE( N-1 ) ) )
-
 
9845
         ALTSGN = -ALTSGN
-
 
9846
  110 CONTINUE
-
 
9847
      KASE = 1
-
 
9848
      ISAVE( 1 ) = 5
-
 
9849
      RETURN
-
 
9850
*
-
 
9851
*     ................ ENTRY   (ISAVE( 1 ) = 5)
-
 
9852
*     X HAS BEEN OVERWRITTEN BY A*X.
-
 
9853
*
-
 
9854
  120 CONTINUE
-
 
9855
      TEMP = TWO*( DZSUM1( N, X, 1 ) / DBLE( 3*N ) )
-
 
9856
      IF( TEMP.GT.EST ) THEN
-
 
9857
         CALL ZCOPY( N, X, 1, V, 1 )
-
 
9858
         EST = TEMP
-
 
9859
      END IF
-
 
9860
*
-
 
9861
  130 CONTINUE
-
 
9862
      KASE = 0
-
 
9863
      RETURN
-
 
9864
*
-
 
9865
*     End of ZLACN2
-
 
9866
*
-
 
9867
      END
9245
      SUBROUTINE ZLACPY( UPLO, M, N, A, LDA, B, LDB )
9868
      SUBROUTINE ZLACPY( UPLO, M, N, A, LDA, B, LDB )
9246
*
9869
*
9247
*  -- LAPACK auxiliary routine (version 3.1) --
9870
*  -- LAPACK auxiliary routine (version 3.1) --
9248
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
9871
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
9249
*     November 2006
9872
*     November 2006
Line 9958... Line 10581...
9958
*
10581
*
9959
*  =====================================================================
10582
*  =====================================================================
9960
*
10583
*
9961
*     .. Parameters ..
10584
*     .. Parameters ..
9962
      COMPLEX*16        ZERO, ONE
10585
      COMPLEX*16        ZERO, ONE
9963
      PARAMETER          ( ZERO = ( 0.0D+0, 0.0D+0 ), 
10586
      PARAMETER          ( ZERO = ( 0.0D+0, 0.0D+0 ),
9964
     $                     ONE = ( 1.0D+0, 0.0D+0 ) )
10587
     $                     ONE = ( 1.0D+0, 0.0D+0 ) )
9965
*     ..
10588
*     ..
9966
*     .. Local Scalars ..
10589
*     .. Local Scalars ..
9967
      INTEGER            I
10590
      INTEGER            I
9968
      COMPLEX*16        EI
10591
      COMPLEX*16        EI
Line 9986... Line 10609...
9986
*
10609
*
9987
*           Update A(K+1:N,I)
10610
*           Update A(K+1:N,I)
9988
*
10611
*
9989
*           Update I-th column of A - Y * V'
10612
*           Update I-th column of A - Y * V'
9990
*
10613
*
9991
            CALL ZLACGV( I-1, A( K+I-1, 1 ), LDA ) 
10614
            CALL ZLACGV( I-1, A( K+I-1, 1 ), LDA )
9992
            CALL ZGEMV( 'NO TRANSPOSE', N-K, I-1, -ONE, Y(K+1,1), LDY,
10615
            CALL ZGEMV( 'NO TRANSPOSE', N-K, I-1, -ONE, Y(K+1,1), LDY,
9993
     $                  A( K+I-1, 1 ), LDA, ONE, A( K+1, I ), 1 )
10616
     $                  A( K+I-1, 1 ), LDA, ONE, A( K+1, I ), 1 )
9994
            CALL ZLACGV( I-1, A( K+I-1, 1 ), LDA ) 
10617
            CALL ZLACGV( I-1, A( K+I-1, 1 ), LDA )
9995
*
10618
*
9996
*           Apply I - V * T' * V' to this column (call it b) from the
10619
*           Apply I - V * T' * V' to this column (call it b) from the
9997
*           left, using the last column of T as workspace
10620
*           left, using the last column of T as workspace
9998
*
10621
*
9999
*           Let  V = ( V1 )   and   b = ( b1 )   (first I-1 rows)
10622
*           Let  V = ( V1 )   and   b = ( b1 )   (first I-1 rows)
Line 10002... Line 10625...
10002
*           where V1 is unit lower triangular
10625
*           where V1 is unit lower triangular
10003
*
10626
*
10004
*           w := V1' * b1
10627
*           w := V1' * b1
10005
*
10628
*
10006
            CALL ZCOPY( I-1, A( K+1, I ), 1, T( 1, NB ), 1 )
10629
            CALL ZCOPY( I-1, A( K+1, I ), 1, T( 1, NB ), 1 )
10007
            CALL ZTRMV( 'Lower', 'Conjugate transpose', 'UNIT', 
10630
            CALL ZTRMV( 'Lower', 'Conjugate transpose', 'UNIT',
10008
     $                  I-1, A( K+1, 1 ),
10631
     $                  I-1, A( K+1, 1 ),
10009
     $                  LDA, T( 1, NB ), 1 )
10632
     $                  LDA, T( 1, NB ), 1 )
10010
*
10633
*
10011
*           w := w + V2'*b2
10634
*           w := w + V2'*b2
10012
*
10635
*
10013
            CALL ZGEMV( 'Conjugate transpose', N-K-I+1, I-1, 
10636
            CALL ZGEMV( 'Conjugate transpose', N-K-I+1, I-1,
10014
     $                  ONE, A( K+I, 1 ),
10637
     $                  ONE, A( K+I, 1 ),
10015
     $                  LDA, A( K+I, I ), 1, ONE, T( 1, NB ), 1 )
10638
     $                  LDA, A( K+I, I ), 1, ONE, T( 1, NB ), 1 )
10016
*
10639
*
10017
*           w := T'*w
10640
*           w := T'*w
10018
*
10641
*
10019
            CALL ZTRMV( 'Upper', 'Conjugate transpose', 'NON-UNIT', 
10642
            CALL ZTRMV( 'Upper', 'Conjugate transpose', 'NON-UNIT',
10020
     $                  I-1, T, LDT,
10643
     $                  I-1, T, LDT,
10021
     $                  T( 1, NB ), 1 )
10644
     $                  T( 1, NB ), 1 )
10022
*
10645
*
10023
*           b2 := b2 - V2*w
10646
*           b2 := b2 - V2*w
10024
*
10647
*
10025
            CALL ZGEMV( 'NO TRANSPOSE', N-K-I+1, I-1, -ONE, 
10648
            CALL ZGEMV( 'NO TRANSPOSE', N-K-I+1, I-1, -ONE,
10026
     $                  A( K+I, 1 ),
10649
     $                  A( K+I, 1 ),
10027
     $                  LDA, T( 1, NB ), 1, ONE, A( K+I, I ), 1 )
10650
     $                  LDA, T( 1, NB ), 1, ONE, A( K+I, I ), 1 )
10028
*
10651
*
10029
*           b1 := b1 - V1*w
10652
*           b1 := b1 - V1*w
10030
*
10653
*
10031
            CALL ZTRMV( 'Lower', 'NO TRANSPOSE', 
10654
            CALL ZTRMV( 'Lower', 'NO TRANSPOSE',
10032
     $                  'UNIT', I-1,
10655
     $                  'UNIT', I-1,
10033
     $                  A( K+1, 1 ), LDA, T( 1, NB ), 1 )
10656
     $                  A( K+1, 1 ), LDA, T( 1, NB ), 1 )
10034
            CALL ZAXPY( I-1, -ONE, T( 1, NB ), 1, A( K+1, I ), 1 )
10657
            CALL ZAXPY( I-1, -ONE, T( 1, NB ), 1, A( K+1, I ), 1 )
10035
*
10658
*
10036
            A( K+I-1, I-1 ) = EI
10659
            A( K+I-1, I-1 ) = EI
Line 10044... Line 10667...
10044
         EI = A( K+I, I )
10667
         EI = A( K+I, I )
10045
         A( K+I, I ) = ONE
10668
         A( K+I, I ) = ONE
10046
*
10669
*
10047
*        Compute  Y(K+1:N,I)
10670
*        Compute  Y(K+1:N,I)
10048
*
10671
*
10049
         CALL ZGEMV( 'NO TRANSPOSE', N-K, N-K-I+1, 
10672
         CALL ZGEMV( 'NO TRANSPOSE', N-K, N-K-I+1,
10050
     $               ONE, A( K+1, I+1 ),
10673
     $               ONE, A( K+1, I+1 ),
10051
     $               LDA, A( K+I, I ), 1, ZERO, Y( K+1, I ), 1 )
10674
     $               LDA, A( K+I, I ), 1, ZERO, Y( K+1, I ), 1 )
10052
         CALL ZGEMV( 'Conjugate transpose', N-K-I+1, I-1, 
10675
         CALL ZGEMV( 'Conjugate transpose', N-K-I+1, I-1,
10053
     $               ONE, A( K+I, 1 ), LDA,
10676
     $               ONE, A( K+I, 1 ), LDA,
10054
     $               A( K+I, I ), 1, ZERO, T( 1, I ), 1 )
10677
     $               A( K+I, I ), 1, ZERO, T( 1, I ), 1 )
10055
         CALL ZGEMV( 'NO TRANSPOSE', N-K, I-1, -ONE, 
10678
         CALL ZGEMV( 'NO TRANSPOSE', N-K, I-1, -ONE,
10056
     $               Y( K+1, 1 ), LDY,
10679
     $               Y( K+1, 1 ), LDY,
10057
     $               T( 1, I ), 1, ONE, Y( K+1, I ), 1 )
10680
     $               T( 1, I ), 1, ONE, Y( K+1, I ), 1 )
10058
         CALL ZSCAL( N-K, TAU( I ), Y( K+1, I ), 1 )
10681
         CALL ZSCAL( N-K, TAU( I ), Y( K+1, I ), 1 )
10059
*
10682
*
10060
*        Compute T(1:I,I)
10683
*        Compute T(1:I,I)
10061
*
10684
*
10062
         CALL ZSCAL( I-1, -TAU( I ), T( 1, I ), 1 )
10685
         CALL ZSCAL( I-1, -TAU( I ), T( 1, I ), 1 )
10063
         CALL ZTRMV( 'Upper', 'No Transpose', 'NON-UNIT', 
10686
         CALL ZTRMV( 'Upper', 'No Transpose', 'NON-UNIT',
10064
     $               I-1, T, LDT,
10687
     $               I-1, T, LDT,
10065
     $               T( 1, I ), 1 )
10688
     $               T( 1, I ), 1 )
10066
         T( I, I ) = TAU( I )
10689
         T( I, I ) = TAU( I )
10067
*
10690
*
10068
   10 CONTINUE
10691
   10 CONTINUE
10069
      A( K+NB, NB ) = EI
10692
      A( K+NB, NB ) = EI
10070
*
10693
*
10071
*     Compute Y(1:K,1:NB)
10694
*     Compute Y(1:K,1:NB)
10072
*
10695
*
10073
      CALL ZLACPY( 'ALL', K, NB, A( 1, 2 ), LDA, Y, LDY )
10696
      CALL ZLACPY( 'ALL', K, NB, A( 1, 2 ), LDA, Y, LDY )
10074
      CALL ZTRMM( 'RIGHT', 'Lower', 'NO TRANSPOSE', 
10697
      CALL ZTRMM( 'RIGHT', 'Lower', 'NO TRANSPOSE',
10075
     $            'UNIT', K, NB,
10698
     $            'UNIT', K, NB,
10076
     $            ONE, A( K+1, 1 ), LDA, Y, LDY )
10699
     $            ONE, A( K+1, 1 ), LDA, Y, LDY )
10077
      IF( N.GT.K+NB )
10700
      IF( N.GT.K+NB )
10078
     $   CALL ZGEMM( 'NO TRANSPOSE', 'NO TRANSPOSE', K, 
10701
     $   CALL ZGEMM( 'NO TRANSPOSE', 'NO TRANSPOSE', K,
10079
     $               NB, N-K-NB, ONE,
10702
     $               NB, N-K-NB, ONE,
10080
     $               A( 1, 2+NB ), LDA, A( K+1+NB, 1 ), LDA, ONE, Y,
10703
     $               A( 1, 2+NB ), LDA, A( K+1+NB, 1 ), LDA, ONE, Y,
10081
     $               LDY )
10704
     $               LDY )
10082
      CALL ZTRMM( 'RIGHT', 'Upper', 'NO TRANSPOSE', 
10705
      CALL ZTRMM( 'RIGHT', 'Upper', 'NO TRANSPOSE',
10083
     $            'NON-UNIT', K, NB,
10706
     $            'NON-UNIT', K, NB,
10084
     $            ONE, T, LDT, Y, LDY )
10707
     $            ONE, T, LDT, Y, LDY )
10085
*
10708
*
10086
      RETURN
10709
      RETURN
10087
*
10710
*
Line 10109... Line 10732...
10109
*  matrix A so that elements below the k-th subdiagonal are zero. The
10732
*  matrix A so that elements below the k-th subdiagonal are zero. The
10110
*  reduction is performed by a unitary similarity transformation
10733
*  reduction is performed by a unitary similarity transformation
10111
*  Q' * A * Q. The routine returns the matrices V and T which determine
10734
*  Q' * A * Q. The routine returns the matrices V and T which determine
10112
*  Q as a block reflector I - V*T*V', and also the matrix Y = A * V * T.
10735
*  Q as a block reflector I - V*T*V', and also the matrix Y = A * V * T.
10113
*
10736
*
10114
*  This is an OBSOLETE auxiliary routine. 
10737
*  This is an OBSOLETE auxiliary routine.
10115
*  This routine will be 'deprecated' in a  future release.
10738
*  This routine will be 'deprecated' in a  future release.
10116
*  Please use the new routine ZLAHR2 instead.
10739
*  Please use the new routine ZLAHR2 instead.
10117
*
10740
*
10118
*  Arguments
10741
*  Arguments
10119
*  =========
10742
*  =========
Line 10773... Line 11396...
10773
      RETURN
11396
      RETURN
10774
*
11397
*
10775
*     End of ZLANHS
11398
*     End of ZLANHS
10776
*
11399
*
10777
      END
11400
      END
-
 
11401
      DOUBLE PRECISION FUNCTION ZLANTR( NORM, UPLO, DIAG, M, N, A, LDA,
-
 
11402
     $                 WORK )
-
 
11403
*
-
 
11404
*  -- LAPACK auxiliary routine (version 3.1) --
-
 
11405
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
-
 
11406
*     November 2006
-
 
11407
*
-
 
11408
*     .. Scalar Arguments ..
-
 
11409
      CHARACTER          DIAG, NORM, UPLO
-
 
11410
      INTEGER            LDA, M, N
-
 
11411
*     ..
-
 
11412
*     .. Array Arguments ..
-
 
11413
      DOUBLE PRECISION   WORK( * )
-
 
11414
      COMPLEX*16         A( LDA, * )
-
 
11415
*     ..
-
 
11416
*
-
 
11417
*  Purpose
-
 
11418
*  =======
-
 
11419
*
-
 
11420
*  ZLANTR  returns the value of the one norm,  or the Frobenius norm, or
-
 
11421
*  the  infinity norm,  or the  element of  largest absolute value  of a
-
 
11422
*  trapezoidal or triangular matrix A.
-
 
11423
*
-
 
11424
*  Description
-
 
11425
*  ===========
-
 
11426
*
-
 
11427
*  ZLANTR returns the value
-
 
11428
*
-
 
11429
*     ZLANTR = ( max(abs(A(i,j))), NORM = 'M' or 'm'
-
 
11430
*              (
-
 
11431
*              ( norm1(A),         NORM = '1', 'O' or 'o'
-
 
11432
*              (
-
 
11433
*              ( normI(A),         NORM = 'I' or 'i'
-
 
11434
*              (
-
 
11435
*              ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
-
 
11436
*
-
 
11437
*  where  norm1  denotes the  one norm of a matrix (maximum column sum),
-
 
11438
*  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
-
 
11439
*  normF  denotes the  Frobenius norm of a matrix (square root of sum of
-
 
11440
*  squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
-
 
11441
*
-
 
11442
*  Arguments
-
 
11443
*  =========
-
 
11444
*
-
 
11445
*  NORM    (input) CHARACTER*1
-
 
11446
*          Specifies the value to be returned in ZLANTR as described
-
 
11447
*          above.
-
 
11448
*
-
 
11449
*  UPLO    (input) CHARACTER*1
-
 
11450
*          Specifies whether the matrix A is upper or lower trapezoidal.
-
 
11451
*          = 'U':  Upper trapezoidal
-
 
11452
*          = 'L':  Lower trapezoidal
-
 
11453
*          Note that A is triangular instead of trapezoidal if M = N.
-
 
11454
*
-
 
11455
*  DIAG    (input) CHARACTER*1
-
 
11456
*          Specifies whether or not the matrix A has unit diagonal.
-
 
11457
*          = 'N':  Non-unit diagonal
-
 
11458
*          = 'U':  Unit diagonal
-
 
11459
*
-
 
11460
*  M       (input) INTEGER
-
 
11461
*          The number of rows of the matrix A.  M >= 0, and if
-
 
11462
*          UPLO = 'U', M <= N.  When M = 0, ZLANTR is set to zero.
-
 
11463
*
-
 
11464
*  N       (input) INTEGER
-
 
11465
*          The number of columns of the matrix A.  N >= 0, and if
-
 
11466
*          UPLO = 'L', N <= M.  When N = 0, ZLANTR is set to zero.
-
 
11467
*
-
 
11468
*  A       (input) COMPLEX*16 array, dimension (LDA,N)
-
 
11469
*          The trapezoidal matrix A (A is triangular if M = N).
-
 
11470
*          If UPLO = 'U', the leading m by n upper trapezoidal part of
-
 
11471
*          the array A contains the upper trapezoidal matrix, and the
-
 
11472
*          strictly lower triangular part of A is not referenced.
-
 
11473
*          If UPLO = 'L', the leading m by n lower trapezoidal part of
-
 
11474
*          the array A contains the lower trapezoidal matrix, and the
-
 
11475
*          strictly upper triangular part of A is not referenced.  Note
-
 
11476
*          that when DIAG = 'U', the diagonal elements of A are not
-
 
11477
*          referenced and are assumed to be one.
-
 
11478
*
-
 
11479
*  LDA     (input) INTEGER
-
 
11480
*          The leading dimension of the array A.  LDA >= max(M,1).
-
 
11481
*
-
 
11482
*  WORK    (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
-
 
11483
*          where LWORK >= M when NORM = 'I'; otherwise, WORK is not
-
 
11484
*          referenced.
-
 
11485
*
-
 
11486
* =====================================================================
-
 
11487
*
-
 
11488
*     .. Parameters ..
-
 
11489
      DOUBLE PRECISION   ONE, ZERO
-
 
11490
      PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
-
 
11491
*     ..
-
 
11492
*     .. Local Scalars ..
-
 
11493
      LOGICAL            UDIAG
-
 
11494
      INTEGER            I, J
-
 
11495
      DOUBLE PRECISION   SCALE, SUM, VALUE
-
 
11496
*     ..
-
 
11497
*     .. External Functions ..
-
 
11498
      LOGICAL            LSAME
-
 
11499
      EXTERNAL           LSAME
-
 
11500
*     ..
-
 
11501
*     .. External Subroutines ..
-
 
11502
      EXTERNAL           ZLASSQ
-
 
11503
*     ..
-
 
11504
*     .. Intrinsic Functions ..
-
 
11505
      INTRINSIC          ABS, MAX, MIN, SQRT
-
 
11506
*     ..
-
 
11507
*     .. Executable Statements ..
-
 
11508
*
-
 
11509
      IF( MIN( M, N ).EQ.0 ) THEN
-
 
11510
         VALUE = ZERO
-
 
11511
      ELSE IF( LSAME( NORM, 'M' ) ) THEN
-
 
11512
*
-
 
11513
*        Find max(abs(A(i,j))).
-
 
11514
*
-
 
11515
         IF( LSAME( DIAG, 'U' ) ) THEN
-
 
11516
            VALUE = ONE
-
 
11517
            IF( LSAME( UPLO, 'U' ) ) THEN
-
 
11518
               DO 20 J = 1, N
-
 
11519
                  DO 10 I = 1, MIN( M, J-1 )
-
 
11520
                     VALUE = MAX( VALUE, ABS( A( I, J ) ) )
-
 
11521
   10             CONTINUE
-
 
11522
   20          CONTINUE
-
 
11523
            ELSE
-
 
11524
               DO 40 J = 1, N
-
 
11525
                  DO 30 I = J + 1, M
-
 
11526
                     VALUE = MAX( VALUE, ABS( A( I, J ) ) )
-
 
11527
   30             CONTINUE
-
 
11528
   40          CONTINUE
-
 
11529
            END IF
-
 
11530
         ELSE
-
 
11531
            VALUE = ZERO
-
 
11532
            IF( LSAME( UPLO, 'U' ) ) THEN
-
 
11533
               DO 60 J = 1, N
-
 
11534
                  DO 50 I = 1, MIN( M, J )
-
 
11535
                     VALUE = MAX( VALUE, ABS( A( I, J ) ) )
-
 
11536
   50             CONTINUE
-
 
11537
   60          CONTINUE
-
 
11538
            ELSE
-
 
11539
               DO 80 J = 1, N
-
 
11540
                  DO 70 I = J, M
-
 
11541
                     VALUE = MAX( VALUE, ABS( A( I, J ) ) )
-
 
11542
   70             CONTINUE
-
 
11543
   80          CONTINUE
-
 
11544
            END IF
-
 
11545
         END IF
-
 
11546
      ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
-
 
11547
*
-
 
11548
*        Find norm1(A).
-
 
11549
*
-
 
11550
         VALUE = ZERO
-
 
11551
         UDIAG = LSAME( DIAG, 'U' )
-
 
11552
         IF( LSAME( UPLO, 'U' ) ) THEN
-
 
11553
            DO 110 J = 1, N
-
 
11554
               IF( ( UDIAG ) .AND. ( J.LE.M ) ) THEN
-
 
11555
                  SUM = ONE
-
 
11556
                  DO 90 I = 1, J - 1
-
 
11557
                     SUM = SUM + ABS( A( I, J ) )
-
 
11558
   90             CONTINUE
-
 
11559
               ELSE
-
 
11560
                  SUM = ZERO
-
 
11561
                  DO 100 I = 1, MIN( M, J )
-
 
11562
                     SUM = SUM + ABS( A( I, J ) )
-
 
11563
  100             CONTINUE
-
 
11564
               END IF
-
 
11565
               VALUE = MAX( VALUE, SUM )
-
 
11566
  110       CONTINUE
-
 
11567
         ELSE
-
 
11568
            DO 140 J = 1, N
-
 
11569
               IF( UDIAG ) THEN
-
 
11570
                  SUM = ONE
-
 
11571
                  DO 120 I = J + 1, M
-
 
11572
                     SUM = SUM + ABS( A( I, J ) )
-
 
11573
  120             CONTINUE
-
 
11574
               ELSE
-
 
11575
                  SUM = ZERO
-
 
11576
                  DO 130 I = J, M
-
 
11577
                     SUM = SUM + ABS( A( I, J ) )
-
 
11578
  130             CONTINUE
-
 
11579
               END IF
-
 
11580
               VALUE = MAX( VALUE, SUM )
-
 
11581
  140       CONTINUE
-
 
11582
         END IF
-
 
11583
      ELSE IF( LSAME( NORM, 'I' ) ) THEN
-
 
11584
*
-
 
11585
*        Find normI(A).
-
 
11586
*
-
 
11587
         IF( LSAME( UPLO, 'U' ) ) THEN
-
 
11588
            IF( LSAME( DIAG, 'U' ) ) THEN
-
 
11589
               DO 150 I = 1, M
-
 
11590
                  WORK( I ) = ONE
-
 
11591
  150          CONTINUE
-
 
11592
               DO 170 J = 1, N
-
 
11593
                  DO 160 I = 1, MIN( M, J-1 )
-
 
11594
                     WORK( I ) = WORK( I ) + ABS( A( I, J ) )
-
 
11595
  160             CONTINUE
-
 
11596
  170          CONTINUE
-
 
11597
            ELSE
-
 
11598
               DO 180 I = 1, M
-
 
11599
                  WORK( I ) = ZERO
-
 
11600
  180          CONTINUE
-
 
11601
               DO 200 J = 1, N
-
 
11602
                  DO 190 I = 1, MIN( M, J )
-
 
11603
                     WORK( I ) = WORK( I ) + ABS( A( I, J ) )
-
 
11604
  190             CONTINUE
-
 
11605
  200          CONTINUE
-
 
11606
            END IF
-
 
11607
         ELSE
-
 
11608
            IF( LSAME( DIAG, 'U' ) ) THEN
-
 
11609
               DO 210 I = 1, N
-
 
11610
                  WORK( I ) = ONE
-
 
11611
  210          CONTINUE
-
 
11612
               DO 220 I = N + 1, M
-
 
11613
                  WORK( I ) = ZERO
-
 
11614
  220          CONTINUE
-
 
11615
               DO 240 J = 1, N
-
 
11616
                  DO 230 I = J + 1, M
-
 
11617
                     WORK( I ) = WORK( I ) + ABS( A( I, J ) )
-
 
11618
  230             CONTINUE
-
 
11619
  240          CONTINUE
-
 
11620
            ELSE
-
 
11621
               DO 250 I = 1, M
-
 
11622
                  WORK( I ) = ZERO
-
 
11623
  250          CONTINUE
-
 
11624
               DO 270 J = 1, N
-
 
11625
                  DO 260 I = J, M
-
 
11626
                     WORK( I ) = WORK( I ) + ABS( A( I, J ) )
-
 
11627
  260             CONTINUE
-
 
11628
  270          CONTINUE
-
 
11629
            END IF
-
 
11630
         END IF
-
 
11631
         VALUE = ZERO
-
 
11632
         DO 280 I = 1, M
-
 
11633
            VALUE = MAX( VALUE, WORK( I ) )
-
 
11634
  280    CONTINUE
-
 
11635
      ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
-
 
11636
*
-
 
11637
*        Find normF(A).
-
 
11638
*
-
 
11639
         IF( LSAME( UPLO, 'U' ) ) THEN
-
 
11640
            IF( LSAME( DIAG, 'U' ) ) THEN
-
 
11641
               SCALE = ONE
-
 
11642
               SUM = MIN( M, N )
-
 
11643
               DO 290 J = 2, N
-
 
11644
                  CALL ZLASSQ( MIN( M, J-1 ), A( 1, J ), 1, SCALE, SUM )
-
 
11645
  290          CONTINUE
-
 
11646
            ELSE
-
 
11647
               SCALE = ZERO
-
 
11648
               SUM = ONE
-
 
11649
               DO 300 J = 1, N
-
 
11650
                  CALL ZLASSQ( MIN( M, J ), A( 1, J ), 1, SCALE, SUM )
-
 
11651
  300          CONTINUE
-
 
11652
            END IF
-
 
11653
         ELSE
-
 
11654
            IF( LSAME( DIAG, 'U' ) ) THEN
-
 
11655
               SCALE = ONE
-
 
11656
               SUM = MIN( M, N )
-
 
11657
               DO 310 J = 1, N
-
 
11658
                  CALL ZLASSQ( M-J, A( MIN( M, J+1 ), J ), 1, SCALE,
-
 
11659
     $                         SUM )
-
 
11660
  310          CONTINUE
-
 
11661
            ELSE
-
 
11662
               SCALE = ZERO
-
 
11663
               SUM = ONE
-
 
11664
               DO 320 J = 1, N
-
 
11665
                  CALL ZLASSQ( M-J+1, A( J, J ), 1, SCALE, SUM )
-
 
11666
  320          CONTINUE
-
 
11667
            END IF
-
 
11668
         END IF
-
 
11669
         VALUE = SCALE*SQRT( SUM )
-
 
11670
      END IF
-
 
11671
*
-
 
11672
      ZLANTR = VALUE
-
 
11673
      RETURN
-
 
11674
*
-
 
11675
*     End of ZLANTR
-
 
11676
*
-
 
11677
      END
10778
      SUBROUTINE ZLAQP2( M, N, OFFSET, A, LDA, JPVT, TAU, VN1, VN2,
11678
      SUBROUTINE ZLAQP2( M, N, OFFSET, A, LDA, JPVT, TAU, VN1, VN2,
10779
     $                   WORK )
11679
     $                   WORK )
10780
*
11680
*
10781
*  -- LAPACK auxiliary routine (version 3.1) --
11681
*  -- LAPACK auxiliary routine (version 3.1) --
10782
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
11682
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
Line 11204... Line 12104...
11204
   60 CONTINUE
12104
   60 CONTINUE
11205
      IF( LSTICC.GT.0 ) THEN
12105
      IF( LSTICC.GT.0 ) THEN
11206
         ITEMP = NINT( VN2( LSTICC ) )
12106
         ITEMP = NINT( VN2( LSTICC ) )
11207
         VN1( LSTICC ) = DZNRM2( M-RK, A( RK+1, LSTICC ), 1 )
12107
         VN1( LSTICC ) = DZNRM2( M-RK, A( RK+1, LSTICC ), 1 )
11208
*
12108
*
11209
*        NOTE: The computation of VN1( LSTICC ) relies on the fact that 
12109
*        NOTE: The computation of VN1( LSTICC ) relies on the fact that
11210
*        SNRM2 does not fail on vectors with norm below the value of
12110
*        SNRM2 does not fail on vectors with norm below the value of
11211
*        SQRT(DLAMCH('S')) 
12111
*        SQRT(DLAMCH('S'))
11212
*
12112
*
11213
         VN2( LSTICC ) = VN1( LSTICC )
12113
         VN2( LSTICC ) = VN1( LSTICC )
11214
         LSTICC = ITEMP
12114
         LSTICC = ITEMP
11215
         GO TO 60
12115
         GO TO 60
11216
      END IF
12116
      END IF
Line 16558... Line 17458...
16558
*     A := A*P**T
17458
*     A := A*P**T
16559
*
17459
*
16560
*  where P is an orthogonal matrix consisting of a sequence of z plane
17460
*  where P is an orthogonal matrix consisting of a sequence of z plane
16561
*  rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',
17461
*  rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',
16562
*  and P**T is the transpose of P.
17462
*  and P**T is the transpose of P.
16563
*  
17463
*
16564
*  When DIRECT = 'F' (Forward sequence), then
17464
*  When DIRECT = 'F' (Forward sequence), then
16565
*  
17465
*
16566
*     P = P(z-1) * ... * P(2) * P(1)
17466
*     P = P(z-1) * ... * P(2) * P(1)
16567
*  
17467
*
16568
*  and when DIRECT = 'B' (Backward sequence), then
17468
*  and when DIRECT = 'B' (Backward sequence), then
16569
*  
17469
*
16570
*     P = P(1) * P(2) * ... * P(z-1)
17470
*     P = P(1) * P(2) * ... * P(z-1)
16571
*  
17471
*
16572
*  where P(k) is a plane rotation matrix defined by the 2-by-2 rotation
17472
*  where P(k) is a plane rotation matrix defined by the 2-by-2 rotation
16573
*  
17473
*
16574
*     R(k) = (  c(k)  s(k) )
17474
*     R(k) = (  c(k)  s(k) )
16575
*          = ( -s(k)  c(k) ).
17475
*          = ( -s(k)  c(k) ).
16576
*  
17476
*
16577
*  When PIVOT = 'V' (Variable pivot), the rotation is performed
17477
*  When PIVOT = 'V' (Variable pivot), the rotation is performed
16578
*  for the plane (k,k+1), i.e., P(k) has the form
17478
*  for the plane (k,k+1), i.e., P(k) has the form
16579
*  
17479
*
16580
*     P(k) = (  1                                            )
17480
*     P(k) = (  1                                            )
16581
*            (       ...                                     )
17481
*            (       ...                                     )
16582
*            (              1                                )
17482
*            (              1                                )
16583
*            (                   c(k)  s(k)                  )
17483
*            (                   c(k)  s(k)                  )
16584
*            (                  -s(k)  c(k)                  )
17484
*            (                  -s(k)  c(k)                  )
16585
*            (                                1              )
17485
*            (                                1              )
16586
*            (                                     ...       )
17486
*            (                                     ...       )
16587
*            (                                            1  )
17487
*            (                                            1  )
16588
*  
17488
*
16589
*  where R(k) appears as a rank-2 modification to the identity matrix in
17489
*  where R(k) appears as a rank-2 modification to the identity matrix in
16590
*  rows and columns k and k+1.
17490
*  rows and columns k and k+1.
16591
*  
17491
*
16592
*  When PIVOT = 'T' (Top pivot), the rotation is performed for the
17492
*  When PIVOT = 'T' (Top pivot), the rotation is performed for the
16593
*  plane (1,k+1), so P(k) has the form
17493
*  plane (1,k+1), so P(k) has the form
16594
*  
17494
*
16595
*     P(k) = (  c(k)                    s(k)                 )
17495
*     P(k) = (  c(k)                    s(k)                 )
16596
*            (         1                                     )
17496
*            (         1                                     )
16597
*            (              ...                              )
17497
*            (              ...                              )
16598
*            (                     1                         )
17498
*            (                     1                         )
16599
*            ( -s(k)                    c(k)                 )
17499
*            ( -s(k)                    c(k)                 )
16600
*            (                                 1             )
17500
*            (                                 1             )
16601
*            (                                      ...      )
17501
*            (                                      ...      )
16602
*            (                                             1 )
17502
*            (                                             1 )
16603
*  
17503
*
16604
*  where R(k) appears in rows and columns 1 and k+1.
17504
*  where R(k) appears in rows and columns 1 and k+1.
16605
*  
17505
*
16606
*  Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is
17506
*  Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is
16607
*  performed for the plane (k,z), giving P(k) the form
17507
*  performed for the plane (k,z), giving P(k) the form
16608
*  
17508
*
16609
*     P(k) = ( 1                                             )
17509
*     P(k) = ( 1                                             )
16610
*            (      ...                                      )
17510
*            (      ...                                      )
16611
*            (             1                                 )
17511
*            (             1                                 )
16612
*            (                  c(k)                    s(k) )
17512
*            (                  c(k)                    s(k) )
16613
*            (                         1                     )
17513
*            (                         1                     )
16614
*            (                              ...              )
17514
*            (                              ...              )
16615
*            (                                     1         )
17515
*            (                                     1         )
16616
*            (                 -s(k)                    c(k) )
17516
*            (                 -s(k)                    c(k) )
16617
*  
17517
*
16618
*  where R(k) appears in rows and columns k and z.  The rotations are
17518
*  where R(k) appears in rows and columns k and z.  The rotations are
16619
*  performed without ever forming P(k) explicitly.
17519
*  performed without ever forming P(k) explicitly.
16620
*
17520
*
16621
*  Arguments
17521
*  Arguments
16622
*  =========
17522
*  =========
Line 19221... Line 20121...
19221
      RETURN
20121
      RETURN
19222
*
20122
*
19223
*     End of ZSTEQR
20123
*     End of ZSTEQR
19224
*
20124
*
19225
      END
20125
      END
-
 
20126
      SUBROUTINE ZTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK,
-
 
20127
     $                   RWORK, INFO )
-
 
20128
*
-
 
20129
*  -- LAPACK routine (version 3.1) --
-
 
20130
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
-
 
20131
*     November 2006
-
 
20132
*
-
 
20133
*     Modified to call ZLACN2 in place of ZLACON, 10 Feb 03, SJH.
-
 
20134
*
-
 
20135
*     .. Scalar Arguments ..
-
 
20136
      CHARACTER          DIAG, NORM, UPLO
-
 
20137
      INTEGER            INFO, LDA, N
-
 
20138
      DOUBLE PRECISION   RCOND
-
 
20139
*     ..
-
 
20140
*     .. Array Arguments ..
-
 
20141
      DOUBLE PRECISION   RWORK( * )
-
 
20142
      COMPLEX*16         A( LDA, * ), WORK( * )
-
 
20143
*     ..
-
 
20144
*
-
 
20145
*  Purpose
-
 
20146
*  =======
-
 
20147
*
-
 
20148
*  ZTRCON estimates the reciprocal of the condition number of a
-
 
20149
*  triangular matrix A, in either the 1-norm or the infinity-norm.
-
 
20150
*
-
 
20151
*  The norm of A is computed and an estimate is obtained for
-
 
20152
*  norm(inv(A)), then the reciprocal of the condition number is
-
 
20153
*  computed as
-
 
20154
*     RCOND = 1 / ( norm(A) * norm(inv(A)) ).
-
 
20155
*
-
 
20156
*  Arguments
-
 
20157
*  =========
-
 
20158
*
-
 
20159
*  NORM    (input) CHARACTER*1
-
 
20160
*          Specifies whether the 1-norm condition number or the
-
 
20161
*          infinity-norm condition number is required:
-
 
20162
*          = '1' or 'O':  1-norm;
-
 
20163
*          = 'I':         Infinity-norm.
-
 
20164
*
-
 
20165
*  UPLO    (input) CHARACTER*1
-
 
20166
*          = 'U':  A is upper triangular;
-
 
20167
*          = 'L':  A is lower triangular.
-
 
20168
*
-
 
20169
*  DIAG    (input) CHARACTER*1
-
 
20170
*          = 'N':  A is non-unit triangular;
-
 
20171
*          = 'U':  A is unit triangular.
-
 
20172
*
-
 
20173
*  N       (input) INTEGER
-
 
20174
*          The order of the matrix A.  N >= 0.
-
 
20175
*
-
 
20176
*  A       (input) COMPLEX*16 array, dimension (LDA,N)
-
 
20177
*          The triangular matrix A.  If UPLO = 'U', the leading N-by-N
-
 
20178
*          upper triangular part of the array A contains the upper
-
 
20179
*          triangular matrix, and the strictly lower triangular part of
-
 
20180
*          A is not referenced.  If UPLO = 'L', the leading N-by-N lower
-
 
20181
*          triangular part of the array A contains the lower triangular
-
 
20182
*          matrix, and the strictly upper triangular part of A is not
-
 
20183
*          referenced.  If DIAG = 'U', the diagonal elements of A are
-
 
20184
*          also not referenced and are assumed to be 1.
-
 
20185
*
-
 
20186
*  LDA     (input) INTEGER
-
 
20187
*          The leading dimension of the array A.  LDA >= max(1,N).
-
 
20188
*
-
 
20189
*  RCOND   (output) DOUBLE PRECISION
-
 
20190
*          The reciprocal of the condition number of the matrix A,
-
 
20191
*          computed as RCOND = 1/(norm(A) * norm(inv(A))).
-
 
20192
*
-
 
20193
*  WORK    (workspace) COMPLEX*16 array, dimension (2*N)
-
 
20194
*
-
 
20195
*  RWORK   (workspace) DOUBLE PRECISION array, dimension (N)
-
 
20196
*
-
 
20197
*  INFO    (output) INTEGER
-
 
20198
*          = 0:  successful exit
-
 
20199
*          < 0:  if INFO = -i, the i-th argument had an illegal value
-
 
20200
*
-
 
20201
*  =====================================================================
-
 
20202
*
-
 
20203
*     .. Parameters ..
-
 
20204
      DOUBLE PRECISION   ONE, ZERO
-
 
20205
      PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
-
 
20206
*     ..
-
 
20207
*     .. Local Scalars ..
-
 
20208
      LOGICAL            NOUNIT, ONENRM, UPPER
-
 
20209
      CHARACTER          NORMIN
-
 
20210
      INTEGER            IX, KASE, KASE1
-
 
20211
      DOUBLE PRECISION   AINVNM, ANORM, SCALE, SMLNUM, XNORM
-
 
20212
      COMPLEX*16         ZDUM
-
 
20213
*     ..
-
 
20214
*     .. Local Arrays ..
-
 
20215
      INTEGER            ISAVE( 3 )
-
 
20216
*     ..
-
 
20217
*     .. External Functions ..
-
 
20218
      LOGICAL            LSAME
-
 
20219
      INTEGER            IZAMAX
-
 
20220
      DOUBLE PRECISION   DLAMCH, ZLANTR
-
 
20221
      EXTERNAL           LSAME, IZAMAX, DLAMCH, ZLANTR
-
 
20222
*     ..
-
 
20223
*     .. External Subroutines ..
-
 
20224
      EXTERNAL           XERBLA, ZDRSCL, ZLACN2, ZLATRS
-
 
20225
*     ..
-
 
20226
*     .. Intrinsic Functions ..
-
 
20227
      INTRINSIC          ABS, DBLE, DIMAG, MAX
-
 
20228
*     ..
-
 
20229
*     .. Statement Functions ..
-
 
20230
      DOUBLE PRECISION   CABS1
-
 
20231
*     ..
-
 
20232
*     .. Statement Function definitions ..
-
 
20233
      CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
-
 
20234
*     ..
-
 
20235
*     .. Executable Statements ..
-
 
20236
*
-
 
20237
*     Test the input parameters.
-
 
20238
*
-
 
20239
      INFO = 0
-
 
20240
      UPPER = LSAME( UPLO, 'U' )
-
 
20241
      ONENRM = NORM.EQ.'1' .OR. LSAME( NORM, 'O' )
-
 
20242
      NOUNIT = LSAME( DIAG, 'N' )
-
 
20243
*
-
 
20244
      IF( .NOT.ONENRM .AND. .NOT.LSAME( NORM, 'I' ) ) THEN
-
 
20245
         INFO = -1
-
 
20246
      ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
-
 
20247
         INFO = -2
-
 
20248
      ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
-
 
20249
         INFO = -3
-
 
20250
      ELSE IF( N.LT.0 ) THEN
-
 
20251
         INFO = -4
-
 
20252
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
-
 
20253
         INFO = -6
-
 
20254
      END IF
-
 
20255
      IF( INFO.NE.0 ) THEN
-
 
20256
         CALL XERBLA( 'ZTRCON', -INFO )
-
 
20257
         RETURN
-
 
20258
      END IF
-
 
20259
*
-
 
20260
*     Quick return if possible
-
 
20261
*
-
 
20262
      IF( N.EQ.0 ) THEN
-
 
20263
         RCOND = ONE
-
 
20264
         RETURN
-
 
20265
      END IF
-
 
20266
*
-
 
20267
      RCOND = ZERO
-
 
20268
      SMLNUM = DLAMCH( 'Safe minimum' )*DBLE( MAX( 1, N ) )
-
 
20269
*
-
 
20270
*     Compute the norm of the triangular matrix A.
-
 
20271
*
-
 
20272
      ANORM = ZLANTR( NORM, UPLO, DIAG, N, N, A, LDA, RWORK )
-
 
20273
*
-
 
20274
*     Continue only if ANORM > 0.
-
 
20275
*
-
 
20276
      IF( ANORM.GT.ZERO ) THEN
-
 
20277
*
-
 
20278
*        Estimate the norm of the inverse of A.
-
 
20279
*
-
 
20280
         AINVNM = ZERO
-
 
20281
         NORMIN = 'N'
-
 
20282
         IF( ONENRM ) THEN
-
 
20283
            KASE1 = 1
-
 
20284
         ELSE
-
 
20285
            KASE1 = 2
-
 
20286
         END IF
-
 
20287
         KASE = 0
-
 
20288
   10    CONTINUE
-
 
20289
         CALL ZLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
-
 
20290
         IF( KASE.NE.0 ) THEN
-
 
20291
            IF( KASE.EQ.KASE1 ) THEN
-
 
20292
*
-
 
20293
*              Multiply by inv(A).
-
 
20294
*
-
 
20295
               CALL ZLATRS( UPLO, 'No transpose', DIAG, NORMIN, N, A,
-
 
20296
     $                      LDA, WORK, SCALE, RWORK, INFO )
-
 
20297
            ELSE
-
 
20298
*
-
 
20299
*              Multiply by inv(A').
-
 
20300
*
-
 
20301
               CALL ZLATRS( UPLO, 'Conjugate transpose', DIAG, NORMIN,
-
 
20302
     $                      N, A, LDA, WORK, SCALE, RWORK, INFO )
-
 
20303
            END IF
-
 
20304
            NORMIN = 'Y'
-
 
20305
*
-
 
20306
*           Multiply by 1/SCALE if doing so will not cause overflow.
-
 
20307
*
-
 
20308
            IF( SCALE.NE.ONE ) THEN
-
 
20309
               IX = IZAMAX( N, WORK, 1 )
-
 
20310
               XNORM = CABS1( WORK( IX ) )
-
 
20311
               IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO )
-
 
20312
     $            GO TO 20
-
 
20313
               CALL ZDRSCL( N, SCALE, WORK, 1 )
-
 
20314
            END IF
-
 
20315
            GO TO 10
-
 
20316
         END IF
-
 
20317
*
-
 
20318
*        Compute the estimate of the reciprocal condition number.
-
 
20319
*
-
 
20320
         IF( AINVNM.NE.ZERO )
-
 
20321
     $      RCOND = ( ONE / ANORM ) / AINVNM
-
 
20322
      END IF
-
 
20323
*
-
 
20324
   20 CONTINUE
-
 
20325
      RETURN
-
 
20326
*
-
 
20327
*     End of ZTRCON
-
 
20328
*
-
 
20329
      END
19226
      SUBROUTINE ZTREVC( SIDE, HOWMNY, SELECT, N, T, LDT, VL, LDVL, VR,
20330
      SUBROUTINE ZTREVC( SIDE, HOWMNY, SELECT, N, T, LDT, VL, LDVL, VR,
19227
     $                   LDVR, MM, M, WORK, RWORK, INFO )
20331
     $                   LDVR, MM, M, WORK, RWORK, INFO )
19228
*
20332
*
19229
*  -- LAPACK routine (version 3.1) --
20333
*  -- LAPACK routine (version 3.1) --
19230
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
20334
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
Line 19246... Line 20350...
19246
*
20350
*
19247
*  ZTREVC computes some or all of the right and/or left eigenvectors of
20351
*  ZTREVC computes some or all of the right and/or left eigenvectors of
19248
*  a complex upper triangular matrix T.
20352
*  a complex upper triangular matrix T.
19249
*  Matrices of this type are produced by the Schur factorization of
20353
*  Matrices of this type are produced by the Schur factorization of
19250
*  a complex general matrix:  A = Q*T*Q**H, as computed by ZHSEQR.
20354
*  a complex general matrix:  A = Q*T*Q**H, as computed by ZHSEQR.
19251
*  
20355
*
19252
*  The right eigenvector x and the left eigenvector y of T corresponding
20356
*  The right eigenvector x and the left eigenvector y of T corresponding
19253
*  to an eigenvalue w are defined by:
20357
*  to an eigenvalue w are defined by:
19254
*  
20358
*
19255
*               T*x = w*x,     (y**H)*T = w*(y**H)
20359
*               T*x = w*x,     (y**H)*T = w*(y**H)
19256
*  
20360
*
19257
*  where y**H denotes the conjugate transpose of the vector y.
20361
*  where y**H denotes the conjugate transpose of the vector y.
19258
*  The eigenvalues are not input to this routine, but are read directly
20362
*  The eigenvalues are not input to this routine, but are read directly
19259
*  from the diagonal of T.
20363
*  from the diagonal of T.
19260
*  
20364
*
19261
*  This routine returns the matrices X and/or Y of right and left
20365
*  This routine returns the matrices X and/or Y of right and left
19262
*  eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an
20366
*  eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an
19263
*  input matrix.  If Q is the unitary factor that reduces a matrix A to
20367
*  input matrix.  If Q is the unitary factor that reduces a matrix A to
19264
*  Schur form T, then Q*X and Q*Y are the matrices of right and left
20368
*  Schur form T, then Q*X and Q*Y are the matrices of right and left
19265
*  eigenvectors of A.
20369
*  eigenvectors of A.