KTH framework for Nek5000 toolboxes; testing version  0.0.1
dorg2l.f
Go to the documentation of this file.
1  SUBROUTINE dorg2l( M, N, K, A, LDA, TAU, WORK, INFO )
2 *
3 * -- LAPACK routine (version 3.0) --
4 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5 * Courant Institute, Argonne National Lab, and Rice University
6 * February 29, 1992
7 *
8 * .. Scalar Arguments ..
9  INTEGER INFO, K, LDA, M, N
10 * ..
11 * .. Array Arguments ..
12  DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
13 * ..
14 *
15 * Purpose
16 * =======
17 *
18 * DORG2L generates an m by n real matrix Q with orthonormal columns,
19 * which is defined as the last n columns of a product of k elementary
20 * reflectors of order m
21 *
22 * Q = H(k) . . . H(2) H(1)
23 *
24 * as returned by DGEQLF.
25 *
26 * Arguments
27 * =========
28 *
29 * M (input) INTEGER
30 * The number of rows of the matrix Q. M >= 0.
31 *
32 * N (input) INTEGER
33 * The number of columns of the matrix Q. M >= N >= 0.
34 *
35 * K (input) INTEGER
36 * The number of elementary reflectors whose product defines the
37 * matrix Q. N >= K >= 0.
38 *
39 * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
40 * On entry, the (n-k+i)-th column must contain the vector which
41 * defines the elementary reflector H(i), for i = 1,2,...,k, as
42 * returned by DGEQLF in the last k columns of its array
43 * argument A.
44 * On exit, the m by n matrix Q.
45 *
46 * LDA (input) INTEGER
47 * The first dimension of the array A. LDA >= max(1,M).
48 *
49 * TAU (input) DOUBLE PRECISION array, dimension (K)
50 * TAU(i) must contain the scalar factor of the elementary
51 * reflector H(i), as returned by DGEQLF.
52 *
53 * WORK (workspace) DOUBLE PRECISION array, dimension (N)
54 *
55 * INFO (output) INTEGER
56 * = 0: successful exit
57 * < 0: if INFO = -i, the i-th argument has an illegal value
58 *
59 * =====================================================================
60 *
61 * .. Parameters ..
62  DOUBLE PRECISION ONE, ZERO
63  parameter( one = 1.0d+0, zero = 0.0d+0 )
64 * ..
65 * .. Local Scalars ..
66  INTEGER I, II, J, L
67 * ..
68 * .. External Subroutines ..
69  EXTERNAL dlarf, dscal, xerbla
70 * ..
71 * .. Intrinsic Functions ..
72  INTRINSIC max
73 * ..
74 * .. Executable Statements ..
75 *
76 * Test the input arguments
77 *
78  info = 0
79  IF( m.LT.0 ) THEN
80  info = -1
81  ELSE IF( n.LT.0 .OR. n.GT.m ) THEN
82  info = -2
83  ELSE IF( k.LT.0 .OR. k.GT.n ) THEN
84  info = -3
85  ELSE IF( lda.LT.max( 1, m ) ) THEN
86  info = -5
87  END IF
88  IF( info.NE.0 ) THEN
89  CALL xerbla( 'DORG2L', -info )
90  RETURN
91  END IF
92 *
93 * Quick return if possible
94 *
95  IF( n.LE.0 )
96  $ RETURN
97 *
98 * Initialise columns 1:n-k to columns of the unit matrix
99 *
100  DO 20 j = 1, n - k
101  DO 10 l = 1, m
102  a( l, j ) = zero
103  10 CONTINUE
104  a( m-n+j, j ) = one
105  20 CONTINUE
106 *
107  DO 40 i = 1, k
108  ii = n - k + i
109 *
110 * Apply H(i) to A(1:m-k+i,1:n-k+i) from the left
111 *
112  a( m-n+ii, ii ) = one
113  CALL dlarf( 'Left', m-n+ii, ii-1, a( 1, ii ), 1, tau( i ), a,
114  $ lda, work )
115  CALL dscal( m-n+ii-1, -tau( i ), a( 1, ii ), 1 )
116  a( m-n+ii, ii ) = one - tau( i )
117 *
118 * Set A(m-k+i+1:m,n-k+i) to zero
119 *
120  DO 30 l = m - n + ii + 1, m
121  a( l, ii ) = zero
122  30 CONTINUE
123  40 CONTINUE
124  RETURN
125 *
126 * End of DORG2L
127 *
128  END
subroutine dlarf(SIDE, M, N, V, INCV, TAU, C, LDC, WORK)
Definition: dlarf.f:2
subroutine dorg2l(M, N, K, A, LDA, TAU, WORK, INFO)
Definition: dorg2l.f:2
subroutine dscal(n, da, dx, incx)
Definition: dscal.f:2
subroutine xerbla(SRNAME, INFO)
Definition: xerbla.f:2