LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
dopmtr.f
Go to the documentation of this file.
1 *> \brief \b DOPMTR
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download DOPMTR + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dopmtr.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dopmtr.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dopmtr.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE DOPMTR( SIDE, UPLO, TRANS, M, N, AP, TAU, C, LDC, WORK,
22 * INFO )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER SIDE, TRANS, UPLO
26 * INTEGER INFO, LDC, M, N
27 * ..
28 * .. Array Arguments ..
29 * DOUBLE PRECISION AP( * ), C( LDC, * ), TAU( * ), WORK( * )
30 * ..
31 *
32 *
33 *> \par Purpose:
34 * =============
35 *>
36 *> \verbatim
37 *>
38 *> DOPMTR overwrites the general real M-by-N matrix C with
39 *>
40 *> SIDE = 'L' SIDE = 'R'
41 *> TRANS = 'N': Q * C C * Q
42 *> TRANS = 'T': Q**T * C C * Q**T
43 *>
44 *> where Q is a real orthogonal matrix of order nq, with nq = m if
45 *> SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
46 *> nq-1 elementary reflectors, as returned by DSPTRD using packed
47 *> storage:
48 *>
49 *> if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
50 *>
51 *> if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
52 *> \endverbatim
53 *
54 * Arguments:
55 * ==========
56 *
57 *> \param[in] SIDE
58 *> \verbatim
59 *> SIDE is CHARACTER*1
60 *> = 'L': apply Q or Q**T from the Left;
61 *> = 'R': apply Q or Q**T from the Right.
62 *> \endverbatim
63 *>
64 *> \param[in] UPLO
65 *> \verbatim
66 *> UPLO is CHARACTER*1
67 *> = 'U': Upper triangular packed storage used in previous
68 *> call to DSPTRD;
69 *> = 'L': Lower triangular packed storage used in previous
70 *> call to DSPTRD.
71 *> \endverbatim
72 *>
73 *> \param[in] TRANS
74 *> \verbatim
75 *> TRANS is CHARACTER*1
76 *> = 'N': No transpose, apply Q;
77 *> = 'T': Transpose, apply Q**T.
78 *> \endverbatim
79 *>
80 *> \param[in] M
81 *> \verbatim
82 *> M is INTEGER
83 *> The number of rows of the matrix C. M >= 0.
84 *> \endverbatim
85 *>
86 *> \param[in] N
87 *> \verbatim
88 *> N is INTEGER
89 *> The number of columns of the matrix C. N >= 0.
90 *> \endverbatim
91 *>
92 *> \param[in] AP
93 *> \verbatim
94 *> AP is DOUBLE PRECISION array, dimension
95 *> (M*(M+1)/2) if SIDE = 'L'
96 *> (N*(N+1)/2) if SIDE = 'R'
97 *> The vectors which define the elementary reflectors, as
98 *> returned by DSPTRD. AP is modified by the routine but
99 *> restored on exit.
100 *> \endverbatim
101 *>
102 *> \param[in] TAU
103 *> \verbatim
104 *> TAU is DOUBLE PRECISION array, dimension (M-1) if SIDE = 'L'
105 *> or (N-1) if SIDE = 'R'
106 *> TAU(i) must contain the scalar factor of the elementary
107 *> reflector H(i), as returned by DSPTRD.
108 *> \endverbatim
109 *>
110 *> \param[in,out] C
111 *> \verbatim
112 *> C is DOUBLE PRECISION array, dimension (LDC,N)
113 *> On entry, the M-by-N matrix C.
114 *> On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
115 *> \endverbatim
116 *>
117 *> \param[in] LDC
118 *> \verbatim
119 *> LDC is INTEGER
120 *> The leading dimension of the array C. LDC >= max(1,M).
121 *> \endverbatim
122 *>
123 *> \param[out] WORK
124 *> \verbatim
125 *> WORK is DOUBLE PRECISION array, dimension
126 *> (N) if SIDE = 'L'
127 *> (M) if SIDE = 'R'
128 *> \endverbatim
129 *>
130 *> \param[out] INFO
131 *> \verbatim
132 *> INFO is INTEGER
133 *> = 0: successful exit
134 *> < 0: if INFO = -i, the i-th argument had an illegal value
135 *> \endverbatim
136 *
137 * Authors:
138 * ========
139 *
140 *> \author Univ. of Tennessee
141 *> \author Univ. of California Berkeley
142 *> \author Univ. of Colorado Denver
143 *> \author NAG Ltd.
144 *
145 *> \date November 2011
146 *
147 *> \ingroup doubleOTHERcomputational
148 *
149 * =====================================================================
150  SUBROUTINE dopmtr( SIDE, UPLO, TRANS, M, N, AP, TAU, C, LDC, WORK,
151  $ info )
152 *
153 * -- LAPACK computational routine (version 3.4.0) --
154 * -- LAPACK is a software package provided by Univ. of Tennessee, --
155 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
156 * November 2011
157 *
158 * .. Scalar Arguments ..
159  CHARACTER side, trans, uplo
160  INTEGER info, ldc, m, n
161 * ..
162 * .. Array Arguments ..
163  DOUBLE PRECISION ap( * ), c( ldc, * ), tau( * ), work( * )
164 * ..
165 *
166 * =====================================================================
167 *
168 * .. Parameters ..
169  DOUBLE PRECISION one
170  parameter( one = 1.0d+0 )
171 * ..
172 * .. Local Scalars ..
173  LOGICAL forwrd, left, notran, upper
174  INTEGER i, i1, i2, i3, ic, ii, jc, mi, ni, nq
175  DOUBLE PRECISION aii
176 * ..
177 * .. External Functions ..
178  LOGICAL lsame
179  EXTERNAL lsame
180 * ..
181 * .. External Subroutines ..
182  EXTERNAL dlarf, xerbla
183 * ..
184 * .. Intrinsic Functions ..
185  INTRINSIC max
186 * ..
187 * .. Executable Statements ..
188 *
189 * Test the input arguments
190 *
191  info = 0
192  left = lsame( side, 'L' )
193  notran = lsame( trans, 'N' )
194  upper = lsame( uplo, 'U' )
195 *
196 * NQ is the order of Q
197 *
198  IF( left ) THEN
199  nq = m
200  ELSE
201  nq = n
202  END IF
203  IF( .NOT.left .AND. .NOT.lsame( side, 'R' ) ) THEN
204  info = -1
205  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
206  info = -2
207  ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) ) THEN
208  info = -3
209  ELSE IF( m.LT.0 ) THEN
210  info = -4
211  ELSE IF( n.LT.0 ) THEN
212  info = -5
213  ELSE IF( ldc.LT.max( 1, m ) ) THEN
214  info = -9
215  END IF
216  IF( info.NE.0 ) THEN
217  CALL xerbla( 'DOPMTR', -info )
218  return
219  END IF
220 *
221 * Quick return if possible
222 *
223  IF( m.EQ.0 .OR. n.EQ.0 )
224  $ return
225 *
226  IF( upper ) THEN
227 *
228 * Q was determined by a call to DSPTRD with UPLO = 'U'
229 *
230  forwrd = ( left .AND. notran ) .OR.
231  $ ( .NOT.left .AND. .NOT.notran )
232 *
233  IF( forwrd ) THEN
234  i1 = 1
235  i2 = nq - 1
236  i3 = 1
237  ii = 2
238  ELSE
239  i1 = nq - 1
240  i2 = 1
241  i3 = -1
242  ii = nq*( nq+1 ) / 2 - 1
243  END IF
244 *
245  IF( left ) THEN
246  ni = n
247  ELSE
248  mi = m
249  END IF
250 *
251  DO 10 i = i1, i2, i3
252  IF( left ) THEN
253 *
254 * H(i) is applied to C(1:i,1:n)
255 *
256  mi = i
257  ELSE
258 *
259 * H(i) is applied to C(1:m,1:i)
260 *
261  ni = i
262  END IF
263 *
264 * Apply H(i)
265 *
266  aii = ap( ii )
267  ap( ii ) = one
268  CALL dlarf( side, mi, ni, ap( ii-i+1 ), 1, tau( i ), c, ldc,
269  $ work )
270  ap( ii ) = aii
271 *
272  IF( forwrd ) THEN
273  ii = ii + i + 2
274  ELSE
275  ii = ii - i - 1
276  END IF
277  10 continue
278  ELSE
279 *
280 * Q was determined by a call to DSPTRD with UPLO = 'L'.
281 *
282  forwrd = ( left .AND. .NOT.notran ) .OR.
283  $ ( .NOT.left .AND. notran )
284 *
285  IF( forwrd ) THEN
286  i1 = 1
287  i2 = nq - 1
288  i3 = 1
289  ii = 2
290  ELSE
291  i1 = nq - 1
292  i2 = 1
293  i3 = -1
294  ii = nq*( nq+1 ) / 2 - 1
295  END IF
296 *
297  IF( left ) THEN
298  ni = n
299  jc = 1
300  ELSE
301  mi = m
302  ic = 1
303  END IF
304 *
305  DO 20 i = i1, i2, i3
306  aii = ap( ii )
307  ap( ii ) = one
308  IF( left ) THEN
309 *
310 * H(i) is applied to C(i+1:m,1:n)
311 *
312  mi = m - i
313  ic = i + 1
314  ELSE
315 *
316 * H(i) is applied to C(1:m,i+1:n)
317 *
318  ni = n - i
319  jc = i + 1
320  END IF
321 *
322 * Apply H(i)
323 *
324  CALL dlarf( side, mi, ni, ap( ii ), 1, tau( i ),
325  $ c( ic, jc ), ldc, work )
326  ap( ii ) = aii
327 *
328  IF( forwrd ) THEN
329  ii = ii + nq - i + 1
330  ELSE
331  ii = ii - nq + i - 2
332  END IF
333  20 continue
334  END IF
335  return
336 *
337 * End of DOPMTR
338 *
339  END