LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ slarz()

subroutine slarz ( character  side,
integer  m,
integer  n,
integer  l,
real, dimension( * )  v,
integer  incv,
real  tau,
real, dimension( ldc, * )  c,
integer  ldc,
real, dimension( * )  work 
)

SLARZ applies an elementary reflector (as returned by stzrzf) to a general matrix.

Download SLARZ + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 SLARZ applies a real elementary reflector H to a real M-by-N
 matrix C, from either the left or the right. H is represented in the
 form

       H = I - tau * v * v**T

 where tau is a real scalar and v is a real vector.

 If tau = 0, then H is taken to be the unit matrix.


 H is a product of k elementary reflectors as returned by STZRZF.
Parameters
[in]SIDE
          SIDE is CHARACTER*1
          = 'L': form  H * C
          = 'R': form  C * H
[in]M
          M is INTEGER
          The number of rows of the matrix C.
[in]N
          N is INTEGER
          The number of columns of the matrix C.
[in]L
          L is INTEGER
          The number of entries of the vector V containing
          the meaningful part of the Householder vectors.
          If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
[in]V
          V is REAL array, dimension (1+(L-1)*abs(INCV))
          The vector v in the representation of H as returned by
          STZRZF. V is not used if TAU = 0.
[in]INCV
          INCV is INTEGER
          The increment between elements of v. INCV <> 0.
[in]TAU
          TAU is REAL
          The value tau in the representation of H.
[in,out]C
          C is REAL array, dimension (LDC,N)
          On entry, the M-by-N matrix C.
          On exit, C is overwritten by the matrix H * C if SIDE = 'L',
          or C * H if SIDE = 'R'.
[in]LDC
          LDC is INTEGER
          The leading dimension of the array C. LDC >= max(1,M).
[out]WORK
          WORK is REAL array, dimension
                         (N) if SIDE = 'L'
                      or (M) if SIDE = 'R'
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
Further Details:
 

Definition at line 144 of file slarz.f.

145*
146* -- LAPACK computational routine --
147* -- LAPACK is a software package provided by Univ. of Tennessee, --
148* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
149*
150* .. Scalar Arguments ..
151 CHARACTER SIDE
152 INTEGER INCV, L, LDC, M, N
153 REAL TAU
154* ..
155* .. Array Arguments ..
156 REAL C( LDC, * ), V( * ), WORK( * )
157* ..
158*
159* =====================================================================
160*
161* .. Parameters ..
162 REAL ONE, ZERO
163 parameter( one = 1.0e+0, zero = 0.0e+0 )
164* ..
165* .. External Subroutines ..
166 EXTERNAL saxpy, scopy, sgemv, sger
167* ..
168* .. External Functions ..
169 LOGICAL LSAME
170 EXTERNAL lsame
171* ..
172* .. Executable Statements ..
173*
174 IF( lsame( side, 'L' ) ) THEN
175*
176* Form H * C
177*
178 IF( tau.NE.zero ) THEN
179*
180* w( 1:n ) = C( 1, 1:n )
181*
182 CALL scopy( n, c, ldc, work, 1 )
183*
184* w( 1:n ) = w( 1:n ) + C( m-l+1:m, 1:n )**T * v( 1:l )
185*
186 CALL sgemv( 'Transpose', l, n, one, c( m-l+1, 1 ), ldc, v,
187 $ incv, one, work, 1 )
188*
189* C( 1, 1:n ) = C( 1, 1:n ) - tau * w( 1:n )
190*
191 CALL saxpy( n, -tau, work, 1, c, ldc )
192*
193* C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ...
194* tau * v( 1:l ) * w( 1:n )**T
195*
196 CALL sger( l, n, -tau, v, incv, work, 1, c( m-l+1, 1 ),
197 $ ldc )
198 END IF
199*
200 ELSE
201*
202* Form C * H
203*
204 IF( tau.NE.zero ) THEN
205*
206* w( 1:m ) = C( 1:m, 1 )
207*
208 CALL scopy( m, c, 1, work, 1 )
209*
210* w( 1:m ) = w( 1:m ) + C( 1:m, n-l+1:n, 1:n ) * v( 1:l )
211*
212 CALL sgemv( 'No transpose', m, l, one, c( 1, n-l+1 ), ldc,
213 $ v, incv, one, work, 1 )
214*
215* C( 1:m, 1 ) = C( 1:m, 1 ) - tau * w( 1:m )
216*
217 CALL saxpy( m, -tau, work, 1, c, 1 )
218*
219* C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ...
220* tau * w( 1:m ) * v( 1:l )**T
221*
222 CALL sger( m, l, -tau, work, 1, v, incv, c( 1, n-l+1 ),
223 $ ldc )
224*
225 END IF
226*
227 END IF
228*
229 RETURN
230*
231* End of SLARZ
232*
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
Definition saxpy.f:89
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
Definition scopy.f:82
subroutine sgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
SGEMV
Definition sgemv.f:158
subroutine sger(m, n, alpha, x, incx, y, incy, a, lda)
SGER
Definition sger.f:130
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: