LAPACK  3.8.0 LAPACK: Linear Algebra PACKage

## ◆ zgghrd()

 subroutine zgghrd ( character COMPQ, character COMPZ, integer N, integer ILO, integer IHI, complex*16, dimension( lda, * ) A, integer LDA, complex*16, dimension( ldb, * ) B, integer LDB, complex*16, dimension( ldq, * ) Q, integer LDQ, complex*16, dimension( ldz, * ) Z, integer LDZ, integer INFO )

ZGGHRD

Purpose:
``` ZGGHRD reduces a pair of complex matrices (A,B) to generalized upper
Hessenberg form using unitary transformations, where A is a
general matrix and B is upper triangular.  The form of the
generalized eigenvalue problem is
A*x = lambda*B*x,
and B is typically made upper triangular by computing its QR
factorization and moving the unitary matrix Q to the left side
of the equation.

This subroutine simultaneously reduces A to a Hessenberg matrix H:
Q**H*A*Z = H
and transforms B to another upper triangular matrix T:
Q**H*B*Z = T
in order to reduce the problem to its standard form
H*y = lambda*T*y
where y = Z**H*x.

The unitary matrices Q and Z are determined as products of Givens
rotations.  They may either be formed explicitly, or they may be
postmultiplied into input matrices Q1 and Z1, so that
Q1 * A * Z1**H = (Q1*Q) * H * (Z1*Z)**H
Q1 * B * Z1**H = (Q1*Q) * T * (Z1*Z)**H
If Q1 is the unitary matrix from the QR factorization of B in the
original equation A*x = lambda*B*x, then ZGGHRD reduces the original
problem to generalized Hessenberg form.```
Parameters
 [in] COMPQ ``` COMPQ is CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the unitary matrix Q is returned; = 'V': Q must contain a unitary matrix Q1 on entry, and the product Q1*Q is returned.``` [in] COMPZ ``` COMPZ is CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the unitary matrix Z is returned; = 'V': Z must contain a unitary matrix Z1 on entry, and the product Z1*Z is returned.``` [in] N ``` N is INTEGER The order of the matrices A and B. N >= 0.``` [in] ILO ` ILO is INTEGER` [in] IHI ``` IHI is INTEGER ILO and IHI mark the rows and columns of A which are to be reduced. It is assumed that A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set by a previous call to ZGGBAL; otherwise they should be set to 1 and N respectively. 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.``` [in,out] A ``` A is COMPLEX*16 array, dimension (LDA, N) On entry, the N-by-N general matrix to be reduced. On exit, the upper triangle and the first subdiagonal of A are overwritten with the upper Hessenberg matrix H, and the rest is set to zero.``` [in] LDA ``` LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).``` [in,out] B ``` B is COMPLEX*16 array, dimension (LDB, N) On entry, the N-by-N upper triangular matrix B. On exit, the upper triangular matrix T = Q**H B Z. The elements below the diagonal are set to zero.``` [in] LDB ``` LDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).``` [in,out] Q ``` Q is COMPLEX*16 array, dimension (LDQ, N) On entry, if COMPQ = 'V', the unitary matrix Q1, typically from the QR factorization of B. On exit, if COMPQ='I', the unitary matrix Q, and if COMPQ = 'V', the product Q1*Q. Not referenced if COMPQ='N'.``` [in] LDQ ``` LDQ is INTEGER The leading dimension of the array Q. LDQ >= N if COMPQ='V' or 'I'; LDQ >= 1 otherwise.``` [in,out] Z ``` Z is COMPLEX*16 array, dimension (LDZ, N) On entry, if COMPZ = 'V', the unitary matrix Z1. On exit, if COMPZ='I', the unitary matrix Z, and if COMPZ = 'V', the product Z1*Z. Not referenced if COMPZ='N'.``` [in] LDZ ``` LDZ is INTEGER The leading dimension of the array Z. LDZ >= N if COMPZ='V' or 'I'; LDZ >= 1 otherwise.``` [out] INFO ``` INFO is INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.```
Date
December 2016
Further Details:
```  This routine reduces A to Hessenberg and B to triangular form by
an unblocked reduction, as described in _Matrix_Computations_,
by Golub and van Loan (Johns Hopkins Press).```

Definition at line 206 of file zgghrd.f.

206 *
207 * -- LAPACK computational routine (version 3.7.0) --
208 * -- LAPACK is a software package provided by Univ. of Tennessee, --
209 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
210 * December 2016
211 *
212 * .. Scalar Arguments ..
213  CHARACTER compq, compz
214  INTEGER ihi, ilo, info, lda, ldb, ldq, ldz, n
215 * ..
216 * .. Array Arguments ..
217  COMPLEX*16 a( lda, * ), b( ldb, * ), q( ldq, * ),
218  \$ z( ldz, * )
219 * ..
220 *
221 * =====================================================================
222 *
223 * .. Parameters ..
224  COMPLEX*16 cone, czero
225  parameter( cone = ( 1.0d+0, 0.0d+0 ),
226  \$ czero = ( 0.0d+0, 0.0d+0 ) )
227 * ..
228 * .. Local Scalars ..
229  LOGICAL ilq, ilz
230  INTEGER icompq, icompz, jcol, jrow
231  DOUBLE PRECISION c
232  COMPLEX*16 ctemp, s
233 * ..
234 * .. External Functions ..
235  LOGICAL lsame
236  EXTERNAL lsame
237 * ..
238 * .. External Subroutines ..
239  EXTERNAL xerbla, zlartg, zlaset, zrot
240 * ..
241 * .. Intrinsic Functions ..
242  INTRINSIC dconjg, max
243 * ..
244 * .. Executable Statements ..
245 *
246 * Decode COMPQ
247 *
248  IF( lsame( compq, 'N' ) ) THEN
249  ilq = .false.
250  icompq = 1
251  ELSE IF( lsame( compq, 'V' ) ) THEN
252  ilq = .true.
253  icompq = 2
254  ELSE IF( lsame( compq, 'I' ) ) THEN
255  ilq = .true.
256  icompq = 3
257  ELSE
258  icompq = 0
259  END IF
260 *
261 * Decode COMPZ
262 *
263  IF( lsame( compz, 'N' ) ) THEN
264  ilz = .false.
265  icompz = 1
266  ELSE IF( lsame( compz, 'V' ) ) THEN
267  ilz = .true.
268  icompz = 2
269  ELSE IF( lsame( compz, 'I' ) ) THEN
270  ilz = .true.
271  icompz = 3
272  ELSE
273  icompz = 0
274  END IF
275 *
276 * Test the input parameters.
277 *
278  info = 0
279  IF( icompq.LE.0 ) THEN
280  info = -1
281  ELSE IF( icompz.LE.0 ) THEN
282  info = -2
283  ELSE IF( n.LT.0 ) THEN
284  info = -3
285  ELSE IF( ilo.LT.1 ) THEN
286  info = -4
287  ELSE IF( ihi.GT.n .OR. ihi.LT.ilo-1 ) THEN
288  info = -5
289  ELSE IF( lda.LT.max( 1, n ) ) THEN
290  info = -7
291  ELSE IF( ldb.LT.max( 1, n ) ) THEN
292  info = -9
293  ELSE IF( ( ilq .AND. ldq.LT.n ) .OR. ldq.LT.1 ) THEN
294  info = -11
295  ELSE IF( ( ilz .AND. ldz.LT.n ) .OR. ldz.LT.1 ) THEN
296  info = -13
297  END IF
298  IF( info.NE.0 ) THEN
299  CALL xerbla( 'ZGGHRD', -info )
300  RETURN
301  END IF
302 *
303 * Initialize Q and Z if desired.
304 *
305  IF( icompq.EQ.3 )
306  \$ CALL zlaset( 'Full', n, n, czero, cone, q, ldq )
307  IF( icompz.EQ.3 )
308  \$ CALL zlaset( 'Full', n, n, czero, cone, z, ldz )
309 *
310 * Quick return if possible
311 *
312  IF( n.LE.1 )
313  \$ RETURN
314 *
315 * Zero out lower triangle of B
316 *
317  DO 20 jcol = 1, n - 1
318  DO 10 jrow = jcol + 1, n
319  b( jrow, jcol ) = czero
320  10 CONTINUE
321  20 CONTINUE
322 *
323 * Reduce A and B
324 *
325  DO 40 jcol = ilo, ihi - 2
326 *
327  DO 30 jrow = ihi, jcol + 2, -1
328 *
329 * Step 1: rotate rows JROW-1, JROW to kill A(JROW,JCOL)
330 *
331  ctemp = a( jrow-1, jcol )
332  CALL zlartg( ctemp, a( jrow, jcol ), c, s,
333  \$ a( jrow-1, jcol ) )
334  a( jrow, jcol ) = czero
335  CALL zrot( n-jcol, a( jrow-1, jcol+1 ), lda,
336  \$ a( jrow, jcol+1 ), lda, c, s )
337  CALL zrot( n+2-jrow, b( jrow-1, jrow-1 ), ldb,
338  \$ b( jrow, jrow-1 ), ldb, c, s )
339  IF( ilq )
340  \$ CALL zrot( n, q( 1, jrow-1 ), 1, q( 1, jrow ), 1, c,
341  \$ dconjg( s ) )
342 *
343 * Step 2: rotate columns JROW, JROW-1 to kill B(JROW,JROW-1)
344 *
345  ctemp = b( jrow, jrow )
346  CALL zlartg( ctemp, b( jrow, jrow-1 ), c, s,
347  \$ b( jrow, jrow ) )
348  b( jrow, jrow-1 ) = czero
349  CALL zrot( ihi, a( 1, jrow ), 1, a( 1, jrow-1 ), 1, c, s )
350  CALL zrot( jrow-1, b( 1, jrow ), 1, b( 1, jrow-1 ), 1, c,
351  \$ s )
352  IF( ilz )
353  \$ CALL zrot( n, z( 1, jrow ), 1, z( 1, jrow-1 ), 1, c, s )
354  30 CONTINUE
355  40 CONTINUE
356 *
357  RETURN
358 *
359 * End of ZGGHRD
360 *
subroutine zrot(N, CX, INCX, CY, INCY, C, S)
ZROT applies a plane rotation with real cosine and complex sine to a pair of complex vectors...
Definition: zrot.f:105
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine zlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: zlaset.f:108
subroutine zlartg(F, G, CS, SN, R)
ZLARTG generates a plane rotation with real cosine and complex sine.
Definition: zlartg.f:105
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
Here is the call graph for this function:
Here is the caller graph for this function: