1
SUBROUTINE DORGTR( UPLO, N, A, LDA, TAU, WORK, LWORK, INFO )
3
* -- LAPACK routine (version 2.0) --
4
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5
* Courant Institute, Argonne National Lab, and Rice University
8
* .. Scalar Arguments ..
10
INTEGER INFO, LDA, LWORK, N
12
* .. Array Arguments ..
13
DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( LWORK )
19
* DORGTR generates a real orthogonal matrix Q which is defined as the
20
* product of n-1 elementary reflectors of order N, as returned by
23
* if UPLO = 'U', Q = H(n-1) . . . H(2) H(1),
25
* if UPLO = 'L', Q = H(1) H(2) . . . H(n-1).
30
* UPLO (input) CHARACTER*1
31
* = 'U': Upper triangle of A contains elementary reflectors
33
* = 'L': Lower triangle of A contains elementary reflectors
37
* The order of the matrix Q. N >= 0.
39
* A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
40
* On entry, the vectors which define the elementary reflectors,
41
* as returned by DSYTRD.
42
* On exit, the N-by-N orthogonal matrix Q.
45
* The leading dimension of the array A. LDA >= max(1,N).
47
* TAU (input) DOUBLE PRECISION array, dimension (N-1)
48
* TAU(i) must contain the scalar factor of the elementary
49
* reflector H(i), as returned by DSYTRD.
51
* WORK (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
52
* On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
54
* LWORK (input) INTEGER
55
* The dimension of the array WORK. LWORK >= max(1,N-1).
56
* For optimum performance LWORK >= (N-1)*NB, where NB is
57
* the optimal blocksize.
59
* INFO (output) INTEGER
60
* = 0: successful exit
61
* < 0: if INFO = -i, the i-th argument had an illegal value
63
* =====================================================================
66
DOUBLE PRECISION ZERO, ONE
67
PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
73
* .. External Functions ..
77
* .. External Subroutines ..
78
EXTERNAL DORGQL, DORGQR, XERBLA
80
* .. Intrinsic Functions ..
83
* .. Executable Statements ..
85
* Test the input arguments
88
UPPER = LSAME( UPLO, 'U' )
89
IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
91
ELSE IF( N.LT.0 ) THEN
93
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
95
ELSE IF( LWORK.LT.MAX( 1, N-1 ) ) THEN
99
CALL XERBLA( 'DORGTR', -INFO )
103
* Quick return if possible
112
* Q was determined by a call to DSYTRD with UPLO = 'U'
114
* Shift the vectors which define the elementary reflectors one
115
* column to the left, and set the last row and column of Q to
116
* those of the unit matrix
120
A( I, J ) = A( I, J+1 )
129
* Generate Q(1:n-1,1:n-1)
131
CALL DORGQL( N-1, N-1, N-1, A, LDA, TAU, WORK, LWORK, IINFO )
135
* Q was determined by a call to DSYTRD with UPLO = 'L'.
137
* Shift the vectors which define the elementary reflectors one
138
* column to the right, and set the first row and column of Q to
139
* those of the unit matrix
144
A( I, J ) = A( I, J-1 )
153
* Generate Q(2:n,2:n)
155
CALL DORGQR( N-1, N-1, N-1, A( 2, 2 ), LDA, TAU, WORK,