Previous Next Contents Generated Index Doc Set Home



Generation of Q Defined in QL Factorization

The subroutines described in this section generate a matrix Q with orthonormal columns that was defined in a QL factorization computed by xGEQLF.

Calling Sequence

CALL DORGQL 
(M, N, K, DA, LDA, DTAU, DWORK, LDWORK, INFO)
CALL SORGQL 
(M, N, K, SA, LDA, STAU, SWORK, LDWORK, INFO)






void dorgql 
(int m, int n, int k, double *da, int lda, double *dtau, 
int *info)
void sorgql 
(int m, int n, int k, float *sa, int lda, float *stau, 
int *info)

Arguments

M

Number of rows of the matrix Q. M 0.

N

Number of columns of the matrix Q. M N 0.

K

Number of elementary reflectors whose product defines the matrix Q. N K 0.

xA

On entry, A and TAU contain the QL factorization of the matrix A as computed by xGEQLF.
On exit, the M×N matrix Q.

LDA

Leading dimension of the array A as specified in a dimension or type statement. LDA max(1, M).

xTAU

TAU(i) contains the scalar factor of the elementary reflector H(i) for 1 i K as computed by xGEQLF.

xWORK

Scratch array with a dimension of LDWORK.

LDWORK

Leading dimension of the array WORK as specified in a dimension or type statement. LDWORK max(1, N).

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO < 0

The ith argument, where i = |INFO|, had an illegal value.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LDA, LDL, LDWORK, M, N
      PARAMETER        (M = 4)
      PARAMETER        (N = 3)
      PARAMETER        (LDA = M)
      PARAMETER        (LDL = N)
      PARAMETER        (LDWORK = N)
C
      DOUBLE PRECISION  A(LDA,N), L(LDL,N), TAU(N), WORK(LDWORK)
      INTEGER           ICOL, INFO, IROW
C
      EXTERNAL          DCOPY, DGEQLF, DORGQL
      INTRINSIC         ABS
C
C     Initialize the array A to store the matrix A shown below.
C
C         1   2   2
C     A = 1   0  -2
C         1   0   2
C         1  -2  -2
C
      DATA A / 1.0D0,  1.0D0, 1.0D0,  1.0D0,
     $         2.0D0,  0.0D0, 0.0D0, -2.0D0,
     $         2.0D0, -2.0D0, 2.0D0, -2.0D0 /
C
C     Print the initial value of A.
C
      PRINT 1000
      PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, M)
C
C     Compute the QL factorization of A.
C
      CALL DGEQLF (M, N, A, LDA, TAU, WORK, LDWORK, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1020, ABS(INFO)
        STOP 1
      END IF
      DO 100, ICOL = 1, N
        CALL DCOPY (N, A(M-N+1,ICOL), 1, L(1,ICOL), 1)
  100 CONTINUE
C
C     Compute and print the matrix Q used in the QL factorization 
C     of A.
C
      CALL DORGQL (M, N, N, A, LDA, TAU, WORK, LDWORK, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1030, ABS(INFO)
        STOP 2
      END IF
      PRINT 1040
      PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, M)
      PRINT 1050
      DO 110, IROW = 1, N
        PRINT 1010, (L(IROW,ICOL), ICOL = 1, IROW),
     $              (0.0D0, ICOL = IROW + 1, N)
  110 CONTINUE
C
 1000 FORMAT (1X, 'A:')
 1010 FORMAT (3(3X, F8.4))
 1020 FORMAT (1X, 'Illegal value for argument #', I1,
     $        ' in DGEQLF.')
 1030 FORMAT (1X, 'Illegal value for argument #', I1,
     $        ' in DORGQL.')
 1040 FORMAT (/1X, 'Q:')
 1050 FORMAT (/1X, 'L:')
C
      END
 

Sample Output

 
 A:
     1.0000     2.0000     2.0000
     1.0000     0.0000    -2.0000
     1.0000     0.0000     2.0000
     1.0000    -2.0000    -2.0000



 Q:
    -0.5000     0.5000     0.5000
    -0.5000     0.5000    -0.5000
    -0.5000    -0.5000     0.5000
    -0.5000    -0.5000    -0.5000



 L:
    -2.0000     0.0000     0.0000
     0.0000     2.0000     0.0000
     0.0000     2.0000     4.0000






Previous Next Contents Generated Index Doc Set Home