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

◆ clagtm()

subroutine clagtm ( character  trans,
integer  n,
integer  nrhs,
real  alpha,
complex, dimension( * )  dl,
complex, dimension( * )  d,
complex, dimension( * )  du,
complex, dimension( ldx, * )  x,
integer  ldx,
real  beta,
complex, dimension( ldb, * )  b,
integer  ldb 
)

CLAGTM performs a matrix-matrix product of the form C = αAB+βC, where A is a tridiagonal matrix, B and C are rectangular matrices, and α and β are scalars, which may be 0, 1, or -1.

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

Purpose:
 CLAGTM performs a matrix-matrix product of the form

    B := alpha * A * X + beta * B

 where A is a tridiagonal matrix of order N, B and X are N by NRHS
 matrices, and alpha and beta are real scalars, each of which may be
 0., 1., or -1.
Parameters
[in]TRANS
          TRANS is CHARACTER*1
          Specifies the operation applied to A.
          = 'N':  No transpose, B := alpha * A * X + beta * B
          = 'T':  Transpose,    B := alpha * A**T * X + beta * B
          = 'C':  Conjugate transpose, B := alpha * A**H * X + beta * B
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]NRHS
          NRHS is INTEGER
          The number of right hand sides, i.e., the number of columns
          of the matrices X and B.
[in]ALPHA
          ALPHA is REAL
          The scalar alpha.  ALPHA must be 0., 1., or -1.; otherwise,
          it is assumed to be 0.
[in]DL
          DL is COMPLEX array, dimension (N-1)
          The (n-1) sub-diagonal elements of T.
[in]D
          D is COMPLEX array, dimension (N)
          The diagonal elements of T.
[in]DU
          DU is COMPLEX array, dimension (N-1)
          The (n-1) super-diagonal elements of T.
[in]X
          X is COMPLEX array, dimension (LDX,NRHS)
          The N by NRHS matrix X.
[in]LDX
          LDX is INTEGER
          The leading dimension of the array X.  LDX >= max(N,1).
[in]BETA
          BETA is REAL
          The scalar beta.  BETA must be 0., 1., or -1.; otherwise,
          it is assumed to be 1.
[in,out]B
          B is COMPLEX array, dimension (LDB,NRHS)
          On entry, the N by NRHS matrix B.
          On exit, B is overwritten by the matrix expression
          B := alpha * A * X + beta * B.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(N,1).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 143 of file clagtm.f.

145*
146* -- LAPACK auxiliary 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 TRANS
152 INTEGER LDB, LDX, N, NRHS
153 REAL ALPHA, BETA
154* ..
155* .. Array Arguments ..
156 COMPLEX B( LDB, * ), D( * ), DL( * ), DU( * ),
157 $ X( LDX, * )
158* ..
159*
160* =====================================================================
161*
162* .. Parameters ..
163 REAL ONE, ZERO
164 parameter( one = 1.0e+0, zero = 0.0e+0 )
165* ..
166* .. Local Scalars ..
167 INTEGER I, J
168* ..
169* .. External Functions ..
170 LOGICAL LSAME
171 EXTERNAL lsame
172* ..
173* .. Intrinsic Functions ..
174 INTRINSIC conjg
175* ..
176* .. Executable Statements ..
177*
178 IF( n.EQ.0 )
179 $ RETURN
180*
181* Multiply B by BETA if BETA.NE.1.
182*
183 IF( beta.EQ.zero ) THEN
184 DO 20 j = 1, nrhs
185 DO 10 i = 1, n
186 b( i, j ) = zero
187 10 CONTINUE
188 20 CONTINUE
189 ELSE IF( beta.EQ.-one ) THEN
190 DO 40 j = 1, nrhs
191 DO 30 i = 1, n
192 b( i, j ) = -b( i, j )
193 30 CONTINUE
194 40 CONTINUE
195 END IF
196*
197 IF( alpha.EQ.one ) THEN
198 IF( lsame( trans, 'N' ) ) THEN
199*
200* Compute B := B + A*X
201*
202 DO 60 j = 1, nrhs
203 IF( n.EQ.1 ) THEN
204 b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j )
205 ELSE
206 b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j ) +
207 $ du( 1 )*x( 2, j )
208 b( n, j ) = b( n, j ) + dl( n-1 )*x( n-1, j ) +
209 $ d( n )*x( n, j )
210 DO 50 i = 2, n - 1
211 b( i, j ) = b( i, j ) + dl( i-1 )*x( i-1, j ) +
212 $ d( i )*x( i, j ) + du( i )*x( i+1, j )
213 50 CONTINUE
214 END IF
215 60 CONTINUE
216 ELSE IF( lsame( trans, 'T' ) ) THEN
217*
218* Compute B := B + A**T * X
219*
220 DO 80 j = 1, nrhs
221 IF( n.EQ.1 ) THEN
222 b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j )
223 ELSE
224 b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j ) +
225 $ dl( 1 )*x( 2, j )
226 b( n, j ) = b( n, j ) + du( n-1 )*x( n-1, j ) +
227 $ d( n )*x( n, j )
228 DO 70 i = 2, n - 1
229 b( i, j ) = b( i, j ) + du( i-1 )*x( i-1, j ) +
230 $ d( i )*x( i, j ) + dl( i )*x( i+1, j )
231 70 CONTINUE
232 END IF
233 80 CONTINUE
234 ELSE IF( lsame( trans, 'C' ) ) THEN
235*
236* Compute B := B + A**H * X
237*
238 DO 100 j = 1, nrhs
239 IF( n.EQ.1 ) THEN
240 b( 1, j ) = b( 1, j ) + conjg( d( 1 ) )*x( 1, j )
241 ELSE
242 b( 1, j ) = b( 1, j ) + conjg( d( 1 ) )*x( 1, j ) +
243 $ conjg( dl( 1 ) )*x( 2, j )
244 b( n, j ) = b( n, j ) + conjg( du( n-1 ) )*
245 $ x( n-1, j ) + conjg( d( n ) )*x( n, j )
246 DO 90 i = 2, n - 1
247 b( i, j ) = b( i, j ) + conjg( du( i-1 ) )*
248 $ x( i-1, j ) + conjg( d( i ) )*
249 $ x( i, j ) + conjg( dl( i ) )*
250 $ x( i+1, j )
251 90 CONTINUE
252 END IF
253 100 CONTINUE
254 END IF
255 ELSE IF( alpha.EQ.-one ) THEN
256 IF( lsame( trans, 'N' ) ) THEN
257*
258* Compute B := B - A*X
259*
260 DO 120 j = 1, nrhs
261 IF( n.EQ.1 ) THEN
262 b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j )
263 ELSE
264 b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j ) -
265 $ du( 1 )*x( 2, j )
266 b( n, j ) = b( n, j ) - dl( n-1 )*x( n-1, j ) -
267 $ d( n )*x( n, j )
268 DO 110 i = 2, n - 1
269 b( i, j ) = b( i, j ) - dl( i-1 )*x( i-1, j ) -
270 $ d( i )*x( i, j ) - du( i )*x( i+1, j )
271 110 CONTINUE
272 END IF
273 120 CONTINUE
274 ELSE IF( lsame( trans, 'T' ) ) THEN
275*
276* Compute B := B - A**T*X
277*
278 DO 140 j = 1, nrhs
279 IF( n.EQ.1 ) THEN
280 b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j )
281 ELSE
282 b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j ) -
283 $ dl( 1 )*x( 2, j )
284 b( n, j ) = b( n, j ) - du( n-1 )*x( n-1, j ) -
285 $ d( n )*x( n, j )
286 DO 130 i = 2, n - 1
287 b( i, j ) = b( i, j ) - du( i-1 )*x( i-1, j ) -
288 $ d( i )*x( i, j ) - dl( i )*x( i+1, j )
289 130 CONTINUE
290 END IF
291 140 CONTINUE
292 ELSE IF( lsame( trans, 'C' ) ) THEN
293*
294* Compute B := B - A**H*X
295*
296 DO 160 j = 1, nrhs
297 IF( n.EQ.1 ) THEN
298 b( 1, j ) = b( 1, j ) - conjg( d( 1 ) )*x( 1, j )
299 ELSE
300 b( 1, j ) = b( 1, j ) - conjg( d( 1 ) )*x( 1, j ) -
301 $ conjg( dl( 1 ) )*x( 2, j )
302 b( n, j ) = b( n, j ) - conjg( du( n-1 ) )*
303 $ x( n-1, j ) - conjg( d( n ) )*x( n, j )
304 DO 150 i = 2, n - 1
305 b( i, j ) = b( i, j ) - conjg( du( i-1 ) )*
306 $ x( i-1, j ) - conjg( d( i ) )*
307 $ x( i, j ) - conjg( dl( i ) )*
308 $ x( i+1, j )
309 150 CONTINUE
310 END IF
311 160 CONTINUE
312 END IF
313 END IF
314 RETURN
315*
316* End of CLAGTM
317*
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the caller graph for this function: