OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches

Functions

subroutine zlaesy (a, b, c, rt1, rt2, evscal, cs1, sn1)
 ZLAESY computes the eigenvalues and eigenvectors of a 2-by-2 complex symmetric matrix.
double precision function zlansy (norm, uplo, n, a, lda, work)
 ZLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex symmetric matrix.
subroutine zlaqsy (uplo, n, a, lda, s, scond, amax, equed)
 ZLAQSY scales a symmetric/Hermitian matrix, using scaling factors computed by spoequ.
subroutine zsymv (uplo, n, alpha, a, lda, x, incx, beta, y, incy)
 ZSYMV computes a matrix-vector product for a complex symmetric matrix.
subroutine zsyr (uplo, n, alpha, x, incx, a, lda)
 ZSYR performs the symmetric rank-1 update of a complex symmetric matrix.
subroutine zsyswapr (uplo, n, a, lda, i1, i2)
 ZSYSWAPR
subroutine ztgsy2 (trans, ijob, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, rdsum, rdscal, info)
 ZTGSY2 solves the generalized Sylvester equation (unblocked algorithm).

Detailed Description

This is the group of complex16 auxiliary functions for SY matrices

Function Documentation

◆ zlaesy()

subroutine zlaesy ( complex*16 a,
complex*16 b,
complex*16 c,
complex*16 rt1,
complex*16 rt2,
complex*16 evscal,
complex*16 cs1,
complex*16 sn1 )

ZLAESY computes the eigenvalues and eigenvectors of a 2-by-2 complex symmetric matrix.

Download ZLAESY + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZLAESY computes the eigendecomposition of a 2-by-2 symmetric matrix
!>    ( ( A, B );( B, C ) )
!> provided the norm of the matrix of eigenvectors is larger than
!> some threshold value.
!>
!> RT1 is the eigenvalue of larger absolute value, and RT2 of
!> smaller absolute value.  If the eigenvectors are computed, then
!> on return ( CS1, SN1 ) is the unit eigenvector for RT1, hence
!>
!> [  CS1     SN1   ] . [ A  B ] . [ CS1    -SN1   ] = [ RT1  0  ]
!> [ -SN1     CS1   ]   [ B  C ]   [ SN1     CS1   ]   [  0  RT2 ]
!> 
Parameters
[in]A
!>          A is COMPLEX*16
!>          The ( 1, 1 ) element of input matrix.
!> 
[in]B
!>          B is COMPLEX*16
!>          The ( 1, 2 ) element of input matrix.  The ( 2, 1 ) element
!>          is also given by B, since the 2-by-2 matrix is symmetric.
!> 
[in]C
!>          C is COMPLEX*16
!>          The ( 2, 2 ) element of input matrix.
!> 
[out]RT1
!>          RT1 is COMPLEX*16
!>          The eigenvalue of larger modulus.
!> 
[out]RT2
!>          RT2 is COMPLEX*16
!>          The eigenvalue of smaller modulus.
!> 
[out]EVSCAL
!>          EVSCAL is COMPLEX*16
!>          The complex value by which the eigenvector matrix was scaled
!>          to make it orthonormal.  If EVSCAL is zero, the eigenvectors
!>          were not computed.  This means one of two things:  the 2-by-2
!>          matrix could not be diagonalized, or the norm of the matrix
!>          of eigenvectors before scaling was larger than the threshold
!>          value THRESH (set below).
!> 
[out]CS1
!>          CS1 is COMPLEX*16
!> 
[out]SN1
!>          SN1 is COMPLEX*16
!>          If EVSCAL .NE. 0,  ( CS1, SN1 ) is the unit right eigenvector
!>          for RT1.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 114 of file zlaesy.f.

115*
116* -- LAPACK auxiliary routine --
117* -- LAPACK is a software package provided by Univ. of Tennessee, --
118* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
119*
120* .. Scalar Arguments ..
121 COMPLEX*16 A, B, C, CS1, EVSCAL, RT1, RT2, SN1
122* ..
123*
124* =====================================================================
125*
126* .. Parameters ..
127 DOUBLE PRECISION ZERO
128 parameter( zero = 0.0d0 )
129 DOUBLE PRECISION ONE
130 parameter( one = 1.0d0 )
131 COMPLEX*16 CONE
132 parameter( cone = ( 1.0d0, 0.0d0 ) )
133 DOUBLE PRECISION HALF
134 parameter( half = 0.5d0 )
135 DOUBLE PRECISION THRESH
136 parameter( thresh = 0.1d0 )
137* ..
138* .. Local Scalars ..
139 DOUBLE PRECISION BABS, EVNORM, TABS, Z
140 COMPLEX*16 S, T, TMP
141* ..
142* .. Intrinsic Functions ..
143 INTRINSIC abs, max, sqrt
144* ..
145* .. Executable Statements ..
146*
147*
148* Special case: The matrix is actually diagonal.
149* To avoid divide by zero later, we treat this case separately.
150*
151 IF( abs( b ).EQ.zero ) THEN
152 rt1 = a
153 rt2 = c
154 IF( abs( rt1 ).LT.abs( rt2 ) ) THEN
155 tmp = rt1
156 rt1 = rt2
157 rt2 = tmp
158 cs1 = zero
159 sn1 = one
160 ELSE
161 cs1 = one
162 sn1 = zero
163 END IF
164 ELSE
165*
166* Compute the eigenvalues and eigenvectors.
167* The characteristic equation is
168* lambda **2 - (A+C) lambda + (A*C - B*B)
169* and we solve it using the quadratic formula.
170*
171 s = ( a+c )*half
172 t = ( a-c )*half
173*
174* Take the square root carefully to avoid over/under flow.
175*
176 babs = abs( b )
177 tabs = abs( t )
178 z = max( babs, tabs )
179 IF( z.GT.zero )
180 $ t = z*sqrt( ( t / z )**2+( b / z )**2 )
181*
182* Compute the two eigenvalues. RT1 and RT2 are exchanged
183* if necessary so that RT1 will have the greater magnitude.
184*
185 rt1 = s + t
186 rt2 = s - t
187 IF( abs( rt1 ).LT.abs( rt2 ) ) THEN
188 tmp = rt1
189 rt1 = rt2
190 rt2 = tmp
191 END IF
192*
193* Choose CS1 = 1 and SN1 to satisfy the first equation, then
194* scale the components of this eigenvector so that the matrix
195* of eigenvectors X satisfies X * X**T = I . (No scaling is
196* done if the norm of the eigenvalue matrix is less than THRESH.)
197*
198 sn1 = ( rt1-a ) / b
199 tabs = abs( sn1 )
200 IF( tabs.GT.one ) THEN
201 t = tabs*sqrt( ( one / tabs )**2+( sn1 / tabs )**2 )
202 ELSE
203 t = sqrt( cone+sn1*sn1 )
204 END IF
205 evnorm = abs( t )
206 IF( evnorm.GE.thresh ) THEN
207 evscal = cone / t
208 cs1 = evscal
209 sn1 = sn1*evscal
210 ELSE
211 evscal = zero
212 END IF
213 END IF
214 RETURN
215*
216* End of ZLAESY
217*
#define max(a, b)
Definition macros.h:21

◆ zlansy()

double precision function zlansy ( character norm,
character uplo,
integer n,
complex*16, dimension( lda, * ) a,
integer lda,
double precision, dimension( * ) work )

ZLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex symmetric matrix.

Download ZLANSY + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZLANSY  returns the value of the one norm,  or the Frobenius norm, or
!> the  infinity norm,  or the  element of  largest absolute value  of a
!> complex symmetric matrix A.
!> 
Returns
ZLANSY
!>
!>    ZLANSY = ( max(abs(A(i,j))), NORM = 'M' or 'm'
!>             (
!>             ( norm1(A),         NORM = '1', 'O' or 'o'
!>             (
!>             ( normI(A),         NORM = 'I' or 'i'
!>             (
!>             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
!>
!> where  norm1  denotes the  one norm of a matrix (maximum column sum),
!> normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
!> normF  denotes the  Frobenius norm of a matrix (square root of sum of
!> squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
!> 
Parameters
[in]NORM
!>          NORM is CHARACTER*1
!>          Specifies the value to be returned in ZLANSY as described
!>          above.
!> 
[in]UPLO
!>          UPLO is CHARACTER*1
!>          Specifies whether the upper or lower triangular part of the
!>          symmetric matrix A is to be referenced.
!>          = 'U':  Upper triangular part of A is referenced
!>          = 'L':  Lower triangular part of A is referenced
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.  When N = 0, ZLANSY is
!>          set to zero.
!> 
[in]A
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>          The symmetric matrix A.  If UPLO = 'U', the leading n by n
!>          upper triangular part of A contains the upper triangular part
!>          of the matrix A, and the strictly lower triangular part of A
!>          is not referenced.  If UPLO = 'L', the leading n by n lower
!>          triangular part of A contains the lower triangular part of
!>          the matrix A, and the strictly upper triangular part of A is
!>          not referenced.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(N,1).
!> 
[out]WORK
!>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
!>          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
!>          WORK is not referenced.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 122 of file zlansy.f.

123*
124* -- LAPACK auxiliary routine --
125* -- LAPACK is a software package provided by Univ. of Tennessee, --
126* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
127*
128* .. Scalar Arguments ..
129 CHARACTER NORM, UPLO
130 INTEGER LDA, N
131* ..
132* .. Array Arguments ..
133 DOUBLE PRECISION WORK( * )
134 COMPLEX*16 A( LDA, * )
135* ..
136*
137* =====================================================================
138*
139* .. Parameters ..
140 DOUBLE PRECISION ONE, ZERO
141 parameter( one = 1.0d+0, zero = 0.0d+0 )
142* ..
143* .. Local Scalars ..
144 INTEGER I, J
145 DOUBLE PRECISION ABSA, SCALE, SUM, VALUE
146* ..
147* .. External Functions ..
148 LOGICAL LSAME, DISNAN
149 EXTERNAL lsame, disnan
150* ..
151* .. External Subroutines ..
152 EXTERNAL zlassq
153* ..
154* .. Intrinsic Functions ..
155 INTRINSIC abs, sqrt
156* ..
157* .. Executable Statements ..
158*
159 IF( n.EQ.0 ) THEN
160 VALUE = zero
161 ELSE IF( lsame( norm, 'M' ) ) THEN
162*
163* Find max(abs(A(i,j))).
164*
165 VALUE = zero
166 IF( lsame( uplo, 'U' ) ) THEN
167 DO 20 j = 1, n
168 DO 10 i = 1, j
169 sum = abs( a( i, j ) )
170 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
171 10 CONTINUE
172 20 CONTINUE
173 ELSE
174 DO 40 j = 1, n
175 DO 30 i = j, n
176 sum = abs( a( i, j ) )
177 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
178 30 CONTINUE
179 40 CONTINUE
180 END IF
181 ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
182 $ ( norm.EQ.'1' ) ) THEN
183*
184* Find normI(A) ( = norm1(A), since A is symmetric).
185*
186 VALUE = zero
187 IF( lsame( uplo, 'U' ) ) THEN
188 DO 60 j = 1, n
189 sum = zero
190 DO 50 i = 1, j - 1
191 absa = abs( a( i, j ) )
192 sum = sum + absa
193 work( i ) = work( i ) + absa
194 50 CONTINUE
195 work( j ) = sum + abs( a( j, j ) )
196 60 CONTINUE
197 DO 70 i = 1, n
198 sum = work( i )
199 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
200 70 CONTINUE
201 ELSE
202 DO 80 i = 1, n
203 work( i ) = zero
204 80 CONTINUE
205 DO 100 j = 1, n
206 sum = work( j ) + abs( a( j, j ) )
207 DO 90 i = j + 1, n
208 absa = abs( a( i, j ) )
209 sum = sum + absa
210 work( i ) = work( i ) + absa
211 90 CONTINUE
212 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
213 100 CONTINUE
214 END IF
215 ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
216*
217* Find normF(A).
218*
219 scale = zero
220 sum = one
221 IF( lsame( uplo, 'U' ) ) THEN
222 DO 110 j = 2, n
223 CALL zlassq( j-1, a( 1, j ), 1, scale, sum )
224 110 CONTINUE
225 ELSE
226 DO 120 j = 1, n - 1
227 CALL zlassq( n-j, a( j+1, j ), 1, scale, sum )
228 120 CONTINUE
229 END IF
230 sum = 2*sum
231 CALL zlassq( n, a, lda+1, scale, sum )
232 VALUE = scale*sqrt( sum )
233 END IF
234*
235 zlansy = VALUE
236 RETURN
237*
238* End of ZLANSY
239*
norm(diag(diag(diag(inv(mat))) -id.SOL), 2) % destroy mumps instance id.JOB
subroutine zlassq(n, x, incx, scl, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
Definition zlassq.f90:137
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:59
logical function lsame(ca, cb)
LSAME
Definition lsame.f:53
double precision function zlansy(norm, uplo, n, a, lda, work)
ZLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlansy.f:123

◆ zlaqsy()

subroutine zlaqsy ( character uplo,
integer n,
complex*16, dimension( lda, * ) a,
integer lda,
double precision, dimension( * ) s,
double precision scond,
double precision amax,
character equed )

ZLAQSY scales a symmetric/Hermitian matrix, using scaling factors computed by spoequ.

Download ZLAQSY + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZLAQSY equilibrates a symmetric matrix A using the scaling factors
!> in the vector S.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>          Specifies whether the upper or lower triangular part of the
!>          symmetric matrix A is stored.
!>          = 'U':  Upper triangular
!>          = 'L':  Lower triangular
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in,out]A
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
!>          n by n upper triangular part of A contains the upper
!>          triangular part of the matrix A, and the strictly lower
!>          triangular part of A is not referenced.  If UPLO = 'L', the
!>          leading n by n lower triangular part of A contains the lower
!>          triangular part of the matrix A, and the strictly upper
!>          triangular part of A is not referenced.
!>
!>          On exit, if EQUED = 'Y', the equilibrated matrix:
!>          diag(S) * A * diag(S).
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(N,1).
!> 
[in]S
!>          S is DOUBLE PRECISION array, dimension (N)
!>          The scale factors for A.
!> 
[in]SCOND
!>          SCOND is DOUBLE PRECISION
!>          Ratio of the smallest S(i) to the largest S(i).
!> 
[in]AMAX
!>          AMAX is DOUBLE PRECISION
!>          Absolute value of largest matrix entry.
!> 
[out]EQUED
!>          EQUED is CHARACTER*1
!>          Specifies whether or not equilibration was done.
!>          = 'N':  No equilibration.
!>          = 'Y':  Equilibration was done, i.e., A has been replaced by
!>                  diag(S) * A * diag(S).
!> 
Internal Parameters:
!>  THRESH is a threshold value used to decide if scaling should be done
!>  based on the ratio of the scaling factors.  If SCOND < THRESH,
!>  scaling is done.
!>
!>  LARGE and SMALL are threshold values used to decide if scaling should
!>  be done based on the absolute size of the largest matrix element.
!>  If AMAX > LARGE or AMAX < SMALL, scaling is done.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 133 of file zlaqsy.f.

134*
135* -- LAPACK auxiliary routine --
136* -- LAPACK is a software package provided by Univ. of Tennessee, --
137* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138*
139* .. Scalar Arguments ..
140 CHARACTER EQUED, UPLO
141 INTEGER LDA, N
142 DOUBLE PRECISION AMAX, SCOND
143* ..
144* .. Array Arguments ..
145 DOUBLE PRECISION S( * )
146 COMPLEX*16 A( LDA, * )
147* ..
148*
149* =====================================================================
150*
151* .. Parameters ..
152 DOUBLE PRECISION ONE, THRESH
153 parameter( one = 1.0d+0, thresh = 0.1d+0 )
154* ..
155* .. Local Scalars ..
156 INTEGER I, J
157 DOUBLE PRECISION CJ, LARGE, SMALL
158* ..
159* .. External Functions ..
160 LOGICAL LSAME
161 DOUBLE PRECISION DLAMCH
162 EXTERNAL lsame, dlamch
163* ..
164* .. Executable Statements ..
165*
166* Quick return if possible
167*
168 IF( n.LE.0 ) THEN
169 equed = 'N'
170 RETURN
171 END IF
172*
173* Initialize LARGE and SMALL.
174*
175 small = dlamch( 'Safe minimum' ) / dlamch( 'Precision' )
176 large = one / small
177*
178 IF( scond.GE.thresh .AND. amax.GE.small .AND. amax.LE.large ) THEN
179*
180* No equilibration
181*
182 equed = 'N'
183 ELSE
184*
185* Replace A by diag(S) * A * diag(S).
186*
187 IF( lsame( uplo, 'U' ) ) THEN
188*
189* Upper triangle of A is stored.
190*
191 DO 20 j = 1, n
192 cj = s( j )
193 DO 10 i = 1, j
194 a( i, j ) = cj*s( i )*a( i, j )
195 10 CONTINUE
196 20 CONTINUE
197 ELSE
198*
199* Lower triangle of A is stored.
200*
201 DO 40 j = 1, n
202 cj = s( j )
203 DO 30 i = j, n
204 a( i, j ) = cj*s( i )*a( i, j )
205 30 CONTINUE
206 40 CONTINUE
207 END IF
208 equed = 'Y'
209 END IF
210*
211 RETURN
212*
213* End of ZLAQSY
214*
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69

◆ zsymv()

subroutine zsymv ( character uplo,
integer n,
complex*16 alpha,
complex*16, dimension( lda, * ) a,
integer lda,
complex*16, dimension( * ) x,
integer incx,
complex*16 beta,
complex*16, dimension( * ) y,
integer incy )

ZSYMV computes a matrix-vector product for a complex symmetric matrix.

Download ZSYMV + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZSYMV  performs the matrix-vector  operation
!>
!>    y := alpha*A*x + beta*y,
!>
!> where alpha and beta are scalars, x and y are n element vectors and
!> A is an n by n symmetric matrix.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>           On entry, UPLO specifies whether the upper or lower
!>           triangular part of the array A is to be referenced as
!>           follows:
!>
!>              UPLO = 'U' or 'u'   Only the upper triangular part of A
!>                                  is to be referenced.
!>
!>              UPLO = 'L' or 'l'   Only the lower triangular part of A
!>                                  is to be referenced.
!>
!>           Unchanged on exit.
!> 
[in]N
!>          N is INTEGER
!>           On entry, N specifies the order of the matrix A.
!>           N must be at least zero.
!>           Unchanged on exit.
!> 
[in]ALPHA
!>          ALPHA is COMPLEX*16
!>           On entry, ALPHA specifies the scalar alpha.
!>           Unchanged on exit.
!> 
[in]A
!>          A is COMPLEX*16 array, dimension ( LDA, N )
!>           Before entry, with  UPLO = 'U' or 'u', the leading n by n
!>           upper triangular part of the array A must contain the upper
!>           triangular part of the symmetric matrix and the strictly
!>           lower triangular part of A is not referenced.
!>           Before entry, with UPLO = 'L' or 'l', the leading n by n
!>           lower triangular part of the array A must contain the lower
!>           triangular part of the symmetric matrix and the strictly
!>           upper triangular part of A is not referenced.
!>           Unchanged on exit.
!> 
[in]LDA
!>          LDA is INTEGER
!>           On entry, LDA specifies the first dimension of A as declared
!>           in the calling (sub) program. LDA must be at least
!>           max( 1, N ).
!>           Unchanged on exit.
!> 
[in]X
!>          X is COMPLEX*16 array, dimension at least
!>           ( 1 + ( N - 1 )*abs( INCX ) ).
!>           Before entry, the incremented array X must contain the N-
!>           element vector x.
!>           Unchanged on exit.
!> 
[in]INCX
!>          INCX is INTEGER
!>           On entry, INCX specifies the increment for the elements of
!>           X. INCX must not be zero.
!>           Unchanged on exit.
!> 
[in]BETA
!>          BETA is COMPLEX*16
!>           On entry, BETA specifies the scalar beta. When BETA is
!>           supplied as zero then Y need not be set on input.
!>           Unchanged on exit.
!> 
[in,out]Y
!>          Y is COMPLEX*16 array, dimension at least
!>           ( 1 + ( N - 1 )*abs( INCY ) ).
!>           Before entry, the incremented array Y must contain the n
!>           element vector y. On exit, Y is overwritten by the updated
!>           vector y.
!> 
[in]INCY
!>          INCY is INTEGER
!>           On entry, INCY specifies the increment for the elements of
!>           Y. INCY must not be zero.
!>           Unchanged on exit.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 156 of file zsymv.f.

157*
158* -- LAPACK auxiliary routine --
159* -- LAPACK is a software package provided by Univ. of Tennessee, --
160* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
161*
162* .. Scalar Arguments ..
163 CHARACTER UPLO
164 INTEGER INCX, INCY, LDA, N
165 COMPLEX*16 ALPHA, BETA
166* ..
167* .. Array Arguments ..
168 COMPLEX*16 A( LDA, * ), X( * ), Y( * )
169* ..
170*
171* =====================================================================
172*
173* .. Parameters ..
174 COMPLEX*16 ONE
175 parameter( one = ( 1.0d+0, 0.0d+0 ) )
176 COMPLEX*16 ZERO
177 parameter( zero = ( 0.0d+0, 0.0d+0 ) )
178* ..
179* .. Local Scalars ..
180 INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY
181 COMPLEX*16 TEMP1, TEMP2
182* ..
183* .. External Functions ..
184 LOGICAL LSAME
185 EXTERNAL lsame
186* ..
187* .. External Subroutines ..
188 EXTERNAL xerbla
189* ..
190* .. Intrinsic Functions ..
191 INTRINSIC max
192* ..
193* .. Executable Statements ..
194*
195* Test the input parameters.
196*
197 info = 0
198 IF( .NOT.lsame( uplo, 'U' ) .AND. .NOT.lsame( uplo, 'L' ) ) THEN
199 info = 1
200 ELSE IF( n.LT.0 ) THEN
201 info = 2
202 ELSE IF( lda.LT.max( 1, n ) ) THEN
203 info = 5
204 ELSE IF( incx.EQ.0 ) THEN
205 info = 7
206 ELSE IF( incy.EQ.0 ) THEN
207 info = 10
208 END IF
209 IF( info.NE.0 ) THEN
210 CALL xerbla( 'ZSYMV ', info )
211 RETURN
212 END IF
213*
214* Quick return if possible.
215*
216 IF( ( n.EQ.0 ) .OR. ( ( alpha.EQ.zero ) .AND. ( beta.EQ.one ) ) )
217 $ RETURN
218*
219* Set up the start points in X and Y.
220*
221 IF( incx.GT.0 ) THEN
222 kx = 1
223 ELSE
224 kx = 1 - ( n-1 )*incx
225 END IF
226 IF( incy.GT.0 ) THEN
227 ky = 1
228 ELSE
229 ky = 1 - ( n-1 )*incy
230 END IF
231*
232* Start the operations. In this version the elements of A are
233* accessed sequentially with one pass through the triangular part
234* of A.
235*
236* First form y := beta*y.
237*
238 IF( beta.NE.one ) THEN
239 IF( incy.EQ.1 ) THEN
240 IF( beta.EQ.zero ) THEN
241 DO 10 i = 1, n
242 y( i ) = zero
243 10 CONTINUE
244 ELSE
245 DO 20 i = 1, n
246 y( i ) = beta*y( i )
247 20 CONTINUE
248 END IF
249 ELSE
250 iy = ky
251 IF( beta.EQ.zero ) THEN
252 DO 30 i = 1, n
253 y( iy ) = zero
254 iy = iy + incy
255 30 CONTINUE
256 ELSE
257 DO 40 i = 1, n
258 y( iy ) = beta*y( iy )
259 iy = iy + incy
260 40 CONTINUE
261 END IF
262 END IF
263 END IF
264 IF( alpha.EQ.zero )
265 $ RETURN
266 IF( lsame( uplo, 'U' ) ) THEN
267*
268* Form y when A is stored in upper triangle.
269*
270 IF( ( incx.EQ.1 ) .AND. ( incy.EQ.1 ) ) THEN
271 DO 60 j = 1, n
272 temp1 = alpha*x( j )
273 temp2 = zero
274 DO 50 i = 1, j - 1
275 y( i ) = y( i ) + temp1*a( i, j )
276 temp2 = temp2 + a( i, j )*x( i )
277 50 CONTINUE
278 y( j ) = y( j ) + temp1*a( j, j ) + alpha*temp2
279 60 CONTINUE
280 ELSE
281 jx = kx
282 jy = ky
283 DO 80 j = 1, n
284 temp1 = alpha*x( jx )
285 temp2 = zero
286 ix = kx
287 iy = ky
288 DO 70 i = 1, j - 1
289 y( iy ) = y( iy ) + temp1*a( i, j )
290 temp2 = temp2 + a( i, j )*x( ix )
291 ix = ix + incx
292 iy = iy + incy
293 70 CONTINUE
294 y( jy ) = y( jy ) + temp1*a( j, j ) + alpha*temp2
295 jx = jx + incx
296 jy = jy + incy
297 80 CONTINUE
298 END IF
299 ELSE
300*
301* Form y when A is stored in lower triangle.
302*
303 IF( ( incx.EQ.1 ) .AND. ( incy.EQ.1 ) ) THEN
304 DO 100 j = 1, n
305 temp1 = alpha*x( j )
306 temp2 = zero
307 y( j ) = y( j ) + temp1*a( j, j )
308 DO 90 i = j + 1, n
309 y( i ) = y( i ) + temp1*a( i, j )
310 temp2 = temp2 + a( i, j )*x( i )
311 90 CONTINUE
312 y( j ) = y( j ) + alpha*temp2
313 100 CONTINUE
314 ELSE
315 jx = kx
316 jy = ky
317 DO 120 j = 1, n
318 temp1 = alpha*x( jx )
319 temp2 = zero
320 y( jy ) = y( jy ) + temp1*a( j, j )
321 ix = jx
322 iy = jy
323 DO 110 i = j + 1, n
324 ix = ix + incx
325 iy = iy + incy
326 y( iy ) = y( iy ) + temp1*a( i, j )
327 temp2 = temp2 + a( i, j )*x( ix )
328 110 CONTINUE
329 y( jy ) = y( jy ) + alpha*temp2
330 jx = jx + incx
331 jy = jy + incy
332 120 CONTINUE
333 END IF
334 END IF
335*
336 RETURN
337*
338* End of ZSYMV
339*
#define alpha
Definition eval.h:35
subroutine xerbla(srname, info)
XERBLA
Definition xerbla.f:60

◆ zsyr()

subroutine zsyr ( character uplo,
integer n,
complex*16 alpha,
complex*16, dimension( * ) x,
integer incx,
complex*16, dimension( lda, * ) a,
integer lda )

ZSYR performs the symmetric rank-1 update of a complex symmetric matrix.

Download ZSYR + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZSYR   performs the symmetric rank 1 operation
!>
!>    A := alpha*x*x**H + A,
!>
!> where alpha is a complex scalar, x is an n element vector and A is an
!> n by n symmetric matrix.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>           On entry, UPLO specifies whether the upper or lower
!>           triangular part of the array A is to be referenced as
!>           follows:
!>
!>              UPLO = 'U' or 'u'   Only the upper triangular part of A
!>                                  is to be referenced.
!>
!>              UPLO = 'L' or 'l'   Only the lower triangular part of A
!>                                  is to be referenced.
!>
!>           Unchanged on exit.
!> 
[in]N
!>          N is INTEGER
!>           On entry, N specifies the order of the matrix A.
!>           N must be at least zero.
!>           Unchanged on exit.
!> 
[in]ALPHA
!>          ALPHA is COMPLEX*16
!>           On entry, ALPHA specifies the scalar alpha.
!>           Unchanged on exit.
!> 
[in]X
!>          X is COMPLEX*16 array, dimension at least
!>           ( 1 + ( N - 1 )*abs( INCX ) ).
!>           Before entry, the incremented array X must contain the N-
!>           element vector x.
!>           Unchanged on exit.
!> 
[in]INCX
!>          INCX is INTEGER
!>           On entry, INCX specifies the increment for the elements of
!>           X. INCX must not be zero.
!>           Unchanged on exit.
!> 
[in,out]A
!>          A is COMPLEX*16 array, dimension ( LDA, N )
!>           Before entry, with  UPLO = 'U' or 'u', the leading n by n
!>           upper triangular part of the array A must contain the upper
!>           triangular part of the symmetric matrix and the strictly
!>           lower triangular part of A is not referenced. On exit, the
!>           upper triangular part of the array A is overwritten by the
!>           upper triangular part of the updated matrix.
!>           Before entry, with UPLO = 'L' or 'l', the leading n by n
!>           lower triangular part of the array A must contain the lower
!>           triangular part of the symmetric matrix and the strictly
!>           upper triangular part of A is not referenced. On exit, the
!>           lower triangular part of the array A is overwritten by the
!>           lower triangular part of the updated matrix.
!> 
[in]LDA
!>          LDA is INTEGER
!>           On entry, LDA specifies the first dimension of A as declared
!>           in the calling (sub) program. LDA must be at least
!>           max( 1, N ).
!>           Unchanged on exit.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 134 of file zsyr.f.

135*
136* -- LAPACK auxiliary routine --
137* -- LAPACK is a software package provided by Univ. of Tennessee, --
138* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
139*
140* .. Scalar Arguments ..
141 CHARACTER UPLO
142 INTEGER INCX, LDA, N
143 COMPLEX*16 ALPHA
144* ..
145* .. Array Arguments ..
146 COMPLEX*16 A( LDA, * ), X( * )
147* ..
148*
149* =====================================================================
150*
151* .. Parameters ..
152 COMPLEX*16 ZERO
153 parameter( zero = ( 0.0d+0, 0.0d+0 ) )
154* ..
155* .. Local Scalars ..
156 INTEGER I, INFO, IX, J, JX, KX
157 COMPLEX*16 TEMP
158* ..
159* .. External Functions ..
160 LOGICAL LSAME
161 EXTERNAL lsame
162* ..
163* .. External Subroutines ..
164 EXTERNAL xerbla
165* ..
166* .. Intrinsic Functions ..
167 INTRINSIC max
168* ..
169* .. Executable Statements ..
170*
171* Test the input parameters.
172*
173 info = 0
174 IF( .NOT.lsame( uplo, 'U' ) .AND. .NOT.lsame( uplo, 'L' ) ) THEN
175 info = 1
176 ELSE IF( n.LT.0 ) THEN
177 info = 2
178 ELSE IF( incx.EQ.0 ) THEN
179 info = 5
180 ELSE IF( lda.LT.max( 1, n ) ) THEN
181 info = 7
182 END IF
183 IF( info.NE.0 ) THEN
184 CALL xerbla( 'ZSYR ', info )
185 RETURN
186 END IF
187*
188* Quick return if possible.
189*
190 IF( ( n.EQ.0 ) .OR. ( alpha.EQ.zero ) )
191 $ RETURN
192*
193* Set the start point in X if the increment is not unity.
194*
195 IF( incx.LE.0 ) THEN
196 kx = 1 - ( n-1 )*incx
197 ELSE IF( incx.NE.1 ) THEN
198 kx = 1
199 END IF
200*
201* Start the operations. In this version the elements of A are
202* accessed sequentially with one pass through the triangular part
203* of A.
204*
205 IF( lsame( uplo, 'U' ) ) THEN
206*
207* Form A when A is stored in upper triangle.
208*
209 IF( incx.EQ.1 ) THEN
210 DO 20 j = 1, n
211 IF( x( j ).NE.zero ) THEN
212 temp = alpha*x( j )
213 DO 10 i = 1, j
214 a( i, j ) = a( i, j ) + x( i )*temp
215 10 CONTINUE
216 END IF
217 20 CONTINUE
218 ELSE
219 jx = kx
220 DO 40 j = 1, n
221 IF( x( jx ).NE.zero ) THEN
222 temp = alpha*x( jx )
223 ix = kx
224 DO 30 i = 1, j
225 a( i, j ) = a( i, j ) + x( ix )*temp
226 ix = ix + incx
227 30 CONTINUE
228 END IF
229 jx = jx + incx
230 40 CONTINUE
231 END IF
232 ELSE
233*
234* Form A when A is stored in lower triangle.
235*
236 IF( incx.EQ.1 ) THEN
237 DO 60 j = 1, n
238 IF( x( j ).NE.zero ) THEN
239 temp = alpha*x( j )
240 DO 50 i = j, n
241 a( i, j ) = a( i, j ) + x( i )*temp
242 50 CONTINUE
243 END IF
244 60 CONTINUE
245 ELSE
246 jx = kx
247 DO 80 j = 1, n
248 IF( x( jx ).NE.zero ) THEN
249 temp = alpha*x( jx )
250 ix = jx
251 DO 70 i = j, n
252 a( i, j ) = a( i, j ) + x( ix )*temp
253 ix = ix + incx
254 70 CONTINUE
255 END IF
256 jx = jx + incx
257 80 CONTINUE
258 END IF
259 END IF
260*
261 RETURN
262*
263* End of ZSYR
264*

◆ zsyswapr()

subroutine zsyswapr ( character uplo,
integer n,
complex*16, dimension( lda, n ) a,
integer lda,
integer i1,
integer i2 )

ZSYSWAPR

Download ZSYSWAPR + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZSYSWAPR applies an elementary permutation on the rows and the columns of
!> a symmetric matrix.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>          Specifies whether the details of the factorization are stored
!>          as an upper or lower triangular matrix.
!>          = 'U':  Upper triangular, form is A = U*D*U**T;
!>          = 'L':  Lower triangular, form is A = L*D*L**T.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in,out]A
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>          On entry, the NB diagonal matrix D and the multipliers
!>          used to obtain the factor U or L as computed by ZSYTRF.
!>
!>          On exit, if INFO = 0, the (symmetric) inverse of the original
!>          matrix.  If UPLO = 'U', the upper triangular part of the
!>          inverse is formed and the part of A below the diagonal is not
!>          referenced; if UPLO = 'L' the lower triangular part of the
!>          inverse is formed and the part of A above the diagonal is
!>          not referenced.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,N).
!> 
[in]I1
!>          I1 is INTEGER
!>          Index of the first row to swap
!> 
[in]I2
!>          I2 is INTEGER
!>          Index of the second row to swap
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 101 of file zsyswapr.f.

102*
103* -- LAPACK auxiliary routine --
104* -- LAPACK is a software package provided by Univ. of Tennessee, --
105* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
106*
107* .. Scalar Arguments ..
108 CHARACTER UPLO
109 INTEGER I1, I2, LDA, N
110* ..
111* .. Array Arguments ..
112 COMPLEX*16 A( LDA, N )
113*
114* =====================================================================
115*
116* ..
117* .. Local Scalars ..
118 LOGICAL UPPER
119 INTEGER I
120 COMPLEX*16 TMP
121*
122* .. External Functions ..
123 LOGICAL LSAME
124 EXTERNAL lsame
125* ..
126* .. External Subroutines ..
127 EXTERNAL zswap
128* ..
129* .. Executable Statements ..
130*
131 upper = lsame( uplo, 'U' )
132 IF (upper) THEN
133*
134* UPPER
135* first swap
136* - swap column I1 and I2 from I1 to I1-1
137 CALL zswap( i1-1, a(1,i1), 1, a(1,i2), 1 )
138*
139* second swap :
140* - swap A(I1,I1) and A(I2,I2)
141* - swap row I1 from I1+1 to I2-1 with col I2 from I1+1 to I2-1
142 tmp=a(i1,i1)
143 a(i1,i1)=a(i2,i2)
144 a(i2,i2)=tmp
145*
146 DO i=1,i2-i1-1
147 tmp=a(i1,i1+i)
148 a(i1,i1+i)=a(i1+i,i2)
149 a(i1+i,i2)=tmp
150 END DO
151*
152* third swap
153* - swap row I1 and I2 from I2+1 to N
154 DO i=i2+1,n
155 tmp=a(i1,i)
156 a(i1,i)=a(i2,i)
157 a(i2,i)=tmp
158 END DO
159*
160 ELSE
161*
162* LOWER
163* first swap
164* - swap row I1 and I2 from I1 to I1-1
165 CALL zswap( i1-1, a(i1,1), lda, a(i2,1), lda )
166*
167* second swap :
168* - swap A(I1,I1) and A(I2,I2)
169* - swap col I1 from I1+1 to I2-1 with row I2 from I1+1 to I2-1
170 tmp=a(i1,i1)
171 a(i1,i1)=a(i2,i2)
172 a(i2,i2)=tmp
173*
174 DO i=1,i2-i1-1
175 tmp=a(i1+i,i1)
176 a(i1+i,i1)=a(i2,i1+i)
177 a(i2,i1+i)=tmp
178 END DO
179*
180* third swap
181* - swap col I1 and I2 from I2+1 to N
182 DO i=i2+1,n
183 tmp=a(i,i1)
184 a(i,i1)=a(i,i2)
185 a(i,i2)=tmp
186 END DO
187*
188 ENDIF
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81

◆ ztgsy2()

subroutine ztgsy2 ( character trans,
integer ijob,
integer m,
integer n,
complex*16, dimension( lda, * ) a,
integer lda,
complex*16, dimension( ldb, * ) b,
integer ldb,
complex*16, dimension( ldc, * ) c,
integer ldc,
complex*16, dimension( ldd, * ) d,
integer ldd,
complex*16, dimension( lde, * ) e,
integer lde,
complex*16, dimension( ldf, * ) f,
integer ldf,
double precision scale,
double precision rdsum,
double precision rdscal,
integer info )

ZTGSY2 solves the generalized Sylvester equation (unblocked algorithm).

Download ZTGSY2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZTGSY2 solves the generalized Sylvester equation
!>
!>             A * R - L * B = scale * C               (1)
!>             D * R - L * E = scale * F
!>
!> using Level 1 and 2 BLAS, where R and L are unknown M-by-N matrices,
!> (A, D), (B, E) and (C, F) are given matrix pairs of size M-by-M,
!> N-by-N and M-by-N, respectively. A, B, D and E are upper triangular
!> (i.e., (A,D) and (B,E) in generalized Schur form).
!>
!> The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output
!> scaling factor chosen to avoid overflow.
!>
!> In matrix notation solving equation (1) corresponds to solve
!> Zx = scale * b, where Z is defined as
!>
!>        Z = [ kron(In, A)  -kron(B**H, Im) ]             (2)
!>            [ kron(In, D)  -kron(E**H, Im) ],
!>
!> Ik is the identity matrix of size k and X**H is the conjuguate transpose of X.
!> kron(X, Y) is the Kronecker product between the matrices X and Y.
!>
!> If TRANS = 'C', y in the conjugate transposed system Z**H*y = scale*b
!> is solved for, which is equivalent to solve for R and L in
!>
!>             A**H * R  + D**H * L   = scale * C           (3)
!>             R  * B**H + L  * E**H  = scale * -F
!>
!> This case is used to compute an estimate of Dif[(A, D), (B, E)] =
!> = sigma_min(Z) using reverse communication with ZLACON.
!>
!> ZTGSY2 also (IJOB >= 1) contributes to the computation in ZTGSYL
!> of an upper bound on the separation between to matrix pairs. Then
!> the input (A, D), (B, E) are sub-pencils of two matrix pairs in
!> ZTGSYL.
!> 
Parameters
[in]TRANS
!>          TRANS is CHARACTER*1
!>          = 'N': solve the generalized Sylvester equation (1).
!>          = 'T': solve the 'transposed' system (3).
!> 
[in]IJOB
!>          IJOB is INTEGER
!>          Specifies what kind of functionality to be performed.
!>          =0: solve (1) only.
!>          =1: A contribution from this subsystem to a Frobenius
!>              norm-based estimate of the separation between two matrix
!>              pairs is computed. (look ahead strategy is used).
!>          =2: A contribution from this subsystem to a Frobenius
!>              norm-based estimate of the separation between two matrix
!>              pairs is computed. (DGECON on sub-systems is used.)
!>          Not referenced if TRANS = 'T'.
!> 
[in]M
!>          M is INTEGER
!>          On entry, M specifies the order of A and D, and the row
!>          dimension of C, F, R and L.
!> 
[in]N
!>          N is INTEGER
!>          On entry, N specifies the order of B and E, and the column
!>          dimension of C, F, R and L.
!> 
[in]A
!>          A is COMPLEX*16 array, dimension (LDA, M)
!>          On entry, A contains an upper triangular matrix.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the matrix A. LDA >= max(1, M).
!> 
[in]B
!>          B is COMPLEX*16 array, dimension (LDB, N)
!>          On entry, B contains an upper triangular matrix.
!> 
[in]LDB
!>          LDB is INTEGER
!>          The leading dimension of the matrix B. LDB >= max(1, N).
!> 
[in,out]C
!>          C is COMPLEX*16 array, dimension (LDC, N)
!>          On entry, C contains the right-hand-side of the first matrix
!>          equation in (1).
!>          On exit, if IJOB = 0, C has been overwritten by the solution
!>          R.
!> 
[in]LDC
!>          LDC is INTEGER
!>          The leading dimension of the matrix C. LDC >= max(1, M).
!> 
[in]D
!>          D is COMPLEX*16 array, dimension (LDD, M)
!>          On entry, D contains an upper triangular matrix.
!> 
[in]LDD
!>          LDD is INTEGER
!>          The leading dimension of the matrix D. LDD >= max(1, M).
!> 
[in]E
!>          E is COMPLEX*16 array, dimension (LDE, N)
!>          On entry, E contains an upper triangular matrix.
!> 
[in]LDE
!>          LDE is INTEGER
!>          The leading dimension of the matrix E. LDE >= max(1, N).
!> 
[in,out]F
!>          F is COMPLEX*16 array, dimension (LDF, N)
!>          On entry, F contains the right-hand-side of the second matrix
!>          equation in (1).
!>          On exit, if IJOB = 0, F has been overwritten by the solution
!>          L.
!> 
[in]LDF
!>          LDF is INTEGER
!>          The leading dimension of the matrix F. LDF >= max(1, M).
!> 
[out]SCALE
!>          SCALE is DOUBLE PRECISION
!>          On exit, 0 <= SCALE <= 1. If 0 < SCALE < 1, the solutions
!>          R and L (C and F on entry) will hold the solutions to a
!>          slightly perturbed system but the input matrices A, B, D and
!>          E have not been changed. If SCALE = 0, R and L will hold the
!>          solutions to the homogeneous system with C = F = 0.
!>          Normally, SCALE = 1.
!> 
[in,out]RDSUM
!>          RDSUM is DOUBLE PRECISION
!>          On entry, the sum of squares of computed contributions to
!>          the Dif-estimate under computation by ZTGSYL, where the
!>          scaling factor RDSCAL (see below) has been factored out.
!>          On exit, the corresponding sum of squares updated with the
!>          contributions from the current sub-system.
!>          If TRANS = 'T' RDSUM is not touched.
!>          NOTE: RDSUM only makes sense when ZTGSY2 is called by
!>          ZTGSYL.
!> 
[in,out]RDSCAL
!>          RDSCAL is DOUBLE PRECISION
!>          On entry, scaling factor used to prevent overflow in RDSUM.
!>          On exit, RDSCAL is updated w.r.t. the current contributions
!>          in RDSUM.
!>          If TRANS = 'T', RDSCAL is not touched.
!>          NOTE: RDSCAL only makes sense when ZTGSY2 is called by
!>          ZTGSYL.
!> 
[out]INFO
!>          INFO is INTEGER
!>          On exit, if INFO is set to
!>            =0: Successful exit
!>            <0: If INFO = -i, input argument number i is illegal.
!>            >0: The matrix pairs (A, D) and (B, E) have common or very
!>                close eigenvalues.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S-901 87 Umea, Sweden.

Definition at line 256 of file ztgsy2.f.

259*
260* -- LAPACK auxiliary routine --
261* -- LAPACK is a software package provided by Univ. of Tennessee, --
262* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
263*
264* .. Scalar Arguments ..
265 CHARACTER TRANS
266 INTEGER IJOB, INFO, LDA, LDB, LDC, LDD, LDE, LDF, M, N
267 DOUBLE PRECISION RDSCAL, RDSUM, SCALE
268* ..
269* .. Array Arguments ..
270 COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * ),
271 $ D( LDD, * ), E( LDE, * ), F( LDF, * )
272* ..
273*
274* =====================================================================
275*
276* .. Parameters ..
277 DOUBLE PRECISION ZERO, ONE
278 INTEGER LDZ
279 parameter( zero = 0.0d+0, one = 1.0d+0, ldz = 2 )
280* ..
281* .. Local Scalars ..
282 LOGICAL NOTRAN
283 INTEGER I, IERR, J, K
284 DOUBLE PRECISION SCALOC
285 COMPLEX*16 ALPHA
286* ..
287* .. Local Arrays ..
288 INTEGER IPIV( LDZ ), JPIV( LDZ )
289 COMPLEX*16 RHS( LDZ ), Z( LDZ, LDZ )
290* ..
291* .. External Functions ..
292 LOGICAL LSAME
293 EXTERNAL lsame
294* ..
295* .. External Subroutines ..
296 EXTERNAL xerbla, zaxpy, zgesc2, zgetc2, zlatdf, zscal
297* ..
298* .. Intrinsic Functions ..
299 INTRINSIC dcmplx, dconjg, max
300* ..
301* .. Executable Statements ..
302*
303* Decode and test input parameters
304*
305 info = 0
306 ierr = 0
307 notran = lsame( trans, 'N' )
308 IF( .NOT.notran .AND. .NOT.lsame( trans, 'C' ) ) THEN
309 info = -1
310 ELSE IF( notran ) THEN
311 IF( ( ijob.LT.0 ) .OR. ( ijob.GT.2 ) ) THEN
312 info = -2
313 END IF
314 END IF
315 IF( info.EQ.0 ) THEN
316 IF( m.LE.0 ) THEN
317 info = -3
318 ELSE IF( n.LE.0 ) THEN
319 info = -4
320 ELSE IF( lda.LT.max( 1, m ) ) THEN
321 info = -6
322 ELSE IF( ldb.LT.max( 1, n ) ) THEN
323 info = -8
324 ELSE IF( ldc.LT.max( 1, m ) ) THEN
325 info = -10
326 ELSE IF( ldd.LT.max( 1, m ) ) THEN
327 info = -12
328 ELSE IF( lde.LT.max( 1, n ) ) THEN
329 info = -14
330 ELSE IF( ldf.LT.max( 1, m ) ) THEN
331 info = -16
332 END IF
333 END IF
334 IF( info.NE.0 ) THEN
335 CALL xerbla( 'ZTGSY2', -info )
336 RETURN
337 END IF
338*
339 IF( notran ) THEN
340*
341* Solve (I, J) - system
342* A(I, I) * R(I, J) - L(I, J) * B(J, J) = C(I, J)
343* D(I, I) * R(I, J) - L(I, J) * E(J, J) = F(I, J)
344* for I = M, M - 1, ..., 1; J = 1, 2, ..., N
345*
346 scale = one
347 scaloc = one
348 DO 30 j = 1, n
349 DO 20 i = m, 1, -1
350*
351* Build 2 by 2 system
352*
353 z( 1, 1 ) = a( i, i )
354 z( 2, 1 ) = d( i, i )
355 z( 1, 2 ) = -b( j, j )
356 z( 2, 2 ) = -e( j, j )
357*
358* Set up right hand side(s)
359*
360 rhs( 1 ) = c( i, j )
361 rhs( 2 ) = f( i, j )
362*
363* Solve Z * x = RHS
364*
365 CALL zgetc2( ldz, z, ldz, ipiv, jpiv, ierr )
366 IF( ierr.GT.0 )
367 $ info = ierr
368 IF( ijob.EQ.0 ) THEN
369 CALL zgesc2( ldz, z, ldz, rhs, ipiv, jpiv, scaloc )
370 IF( scaloc.NE.one ) THEN
371 DO 10 k = 1, n
372 CALL zscal( m, dcmplx( scaloc, zero ),
373 $ c( 1, k ), 1 )
374 CALL zscal( m, dcmplx( scaloc, zero ),
375 $ f( 1, k ), 1 )
376 10 CONTINUE
377 scale = scale*scaloc
378 END IF
379 ELSE
380 CALL zlatdf( ijob, ldz, z, ldz, rhs, rdsum, rdscal,
381 $ ipiv, jpiv )
382 END IF
383*
384* Unpack solution vector(s)
385*
386 c( i, j ) = rhs( 1 )
387 f( i, j ) = rhs( 2 )
388*
389* Substitute R(I, J) and L(I, J) into remaining equation.
390*
391 IF( i.GT.1 ) THEN
392 alpha = -rhs( 1 )
393 CALL zaxpy( i-1, alpha, a( 1, i ), 1, c( 1, j ), 1 )
394 CALL zaxpy( i-1, alpha, d( 1, i ), 1, f( 1, j ), 1 )
395 END IF
396 IF( j.LT.n ) THEN
397 CALL zaxpy( n-j, rhs( 2 ), b( j, j+1 ), ldb,
398 $ c( i, j+1 ), ldc )
399 CALL zaxpy( n-j, rhs( 2 ), e( j, j+1 ), lde,
400 $ f( i, j+1 ), ldf )
401 END IF
402*
403 20 CONTINUE
404 30 CONTINUE
405 ELSE
406*
407* Solve transposed (I, J) - system:
408* A(I, I)**H * R(I, J) + D(I, I)**H * L(J, J) = C(I, J)
409* R(I, I) * B(J, J) + L(I, J) * E(J, J) = -F(I, J)
410* for I = 1, 2, ..., M, J = N, N - 1, ..., 1
411*
412 scale = one
413 scaloc = one
414 DO 80 i = 1, m
415 DO 70 j = n, 1, -1
416*
417* Build 2 by 2 system Z**H
418*
419 z( 1, 1 ) = dconjg( a( i, i ) )
420 z( 2, 1 ) = -dconjg( b( j, j ) )
421 z( 1, 2 ) = dconjg( d( i, i ) )
422 z( 2, 2 ) = -dconjg( e( j, j ) )
423*
424*
425* Set up right hand side(s)
426*
427 rhs( 1 ) = c( i, j )
428 rhs( 2 ) = f( i, j )
429*
430* Solve Z**H * x = RHS
431*
432 CALL zgetc2( ldz, z, ldz, ipiv, jpiv, ierr )
433 IF( ierr.GT.0 )
434 $ info = ierr
435 CALL zgesc2( ldz, z, ldz, rhs, ipiv, jpiv, scaloc )
436 IF( scaloc.NE.one ) THEN
437 DO 40 k = 1, n
438 CALL zscal( m, dcmplx( scaloc, zero ), c( 1, k ),
439 $ 1 )
440 CALL zscal( m, dcmplx( scaloc, zero ), f( 1, k ),
441 $ 1 )
442 40 CONTINUE
443 scale = scale*scaloc
444 END IF
445*
446* Unpack solution vector(s)
447*
448 c( i, j ) = rhs( 1 )
449 f( i, j ) = rhs( 2 )
450*
451* Substitute R(I, J) and L(I, J) into remaining equation.
452*
453 DO 50 k = 1, j - 1
454 f( i, k ) = f( i, k ) + rhs( 1 )*dconjg( b( k, j ) ) +
455 $ rhs( 2 )*dconjg( e( k, j ) )
456 50 CONTINUE
457 DO 60 k = i + 1, m
458 c( k, j ) = c( k, j ) - dconjg( a( i, k ) )*rhs( 1 ) -
459 $ dconjg( d( i, k ) )*rhs( 2 )
460 60 CONTINUE
461*
462 70 CONTINUE
463 80 CONTINUE
464 END IF
465 RETURN
466*
467* End of ZTGSY2
468*
logical function lde(ri, rj, lr)
Definition dblat2.f:2942
subroutine zgetc2(n, a, lda, ipiv, jpiv, info)
ZGETC2 computes the LU factorization with complete pivoting of the general n-by-n matrix.
Definition zgetc2.f:111
subroutine zgesc2(n, a, lda, rhs, ipiv, jpiv, scale)
ZGESC2 solves a system of linear equations using the LU factorization with complete pivoting computed...
Definition zgesc2.f:115
subroutine zlatdf(ijob, n, z, ldz, rhs, rdsum, rdscal, ipiv, jpiv)
ZLATDF uses the LU factorization of the n-by-n matrix computed by sgetc2 and computes a contribution ...
Definition zlatdf.f:169
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
Definition zaxpy.f:88
subroutine zscal(n, za, zx, incx)
ZSCAL
Definition zscal.f:78