1 *> \brief \b DLARF applies an elementary reflector to a general rectangular matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DLARF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlarf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlarf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlarf.f">
21 * SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
23 * .. Scalar Arguments ..
25 * INTEGER INCV, LDC, M, N
26 * DOUBLE PRECISION TAU
28 * .. Array Arguments ..
29 * DOUBLE PRECISION C( LDC, * ), V( * ), WORK( * )
38 *> DLARF applies a real elementary reflector H to a real m by n matrix
39 *> C, from either the left or the right. H is represented in the form
41 *> H = I - tau * v * v**T
43 *> where tau is a real scalar and v is a real vector.
45 *> If tau = 0, then H is taken to be the unit matrix.
53 *> SIDE is CHARACTER*1
61 *> The number of rows of the matrix C.
67 *> The number of columns of the matrix C.
72 *> V is DOUBLE PRECISION array, dimension
73 *> (1 + (M-1)*abs(INCV)) if SIDE = 'L'
74 *> or (1 + (N-1)*abs(INCV)) if SIDE = 'R'
75 *> The vector v in the representation of H. V is not used if
82 *> The increment between elements of v. INCV <> 0.
87 *> TAU is DOUBLE PRECISION
88 *> The value tau in the representation of H.
93 *> C is DOUBLE PRECISION array, dimension (LDC,N)
94 *> On entry, the m by n matrix C.
95 *> On exit, C is overwritten by the matrix H * C if SIDE = 'L',
96 *> or C * H if SIDE = 'R'.
102 *> The leading dimension of the array C. LDC >= max(1,M).
107 *> WORK is DOUBLE PRECISION array, dimension
109 *> or (M) if SIDE = 'R'
115 *> \author Univ. of Tennessee
116 *> \author Univ. of California Berkeley
117 *> \author Univ. of Colorado Denver
120 *> \date September 2012
122 *> \ingroup doubleOTHERauxiliary
124 * =====================================================================
125 SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
127 * -- LAPACK auxiliary routine (version 3.4.2) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * .. Scalar Arguments ..
134 INTEGER INCV, LDC, M, N
137 * .. Array Arguments ..
138 DOUBLE PRECISION C( LDC, * ), V( * ), WORK( * )
141 * =====================================================================
144 DOUBLE PRECISION ONE, ZERO
145 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
147 * .. Local Scalars ..
149 INTEGER I, LASTV, LASTC
151 * .. External Subroutines ..
154 * .. External Functions ..
156 INTEGER ILADLR, ILADLC
157 EXTERNAL LSAME, ILADLR, ILADLC
159 * .. Executable Statements ..
161 APPLYLEFT = LSAME( SIDE, 'L' )
164 IF( TAU.NE.ZERO ) THEN
165 ! Set up variables for scanning V. LASTV begins pointing to the end
173 I = 1 + (LASTV-1) * INCV
177 ! Look for the last non-zero row in V.
178 DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO )
183 ! Scan for the last non-zero column in C(1:lastv,:).
184 LASTC = ILADLC(LASTV, N, C, LDC)
186 ! Scan for the last non-zero row in C(:,1:lastv).
187 LASTC = ILADLR(M, LASTV, C, LDC)
190 ! Note that lastc.eq.0 renders the BLAS operations null; no special
191 ! case is needed at this level.
196 IF( LASTV.GT.0 ) THEN
198 * w(1:lastc,1) := C(1:lastv,1:lastc)**T * v(1:lastv,1)
200 CALL DGEMV( 'Transpose', LASTV, LASTC, ONE, C, LDC, V, INCV,
203 * C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**T
205 CALL DGER( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC )
211 IF( LASTV.GT.0 ) THEN
213 * w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1)
215 CALL DGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC,
216 $ V, INCV, ZERO, WORK, 1 )
218 * C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**T
220 CALL DGER( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC )