LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
clagtm.f
Go to the documentation of this file.
1*> \brief \b 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.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download CLAGTM + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clagtm.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clagtm.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clagtm.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE CLAGTM( TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX, BETA,
22* B, LDB )
23*
24* .. Scalar Arguments ..
25* CHARACTER TRANS
26* INTEGER LDB, LDX, N, NRHS
27* REAL ALPHA, BETA
28* ..
29* .. Array Arguments ..
30* COMPLEX B( LDB, * ), D( * ), DL( * ), DU( * ),
31* $ X( LDX, * )
32* ..
33*
34*
35*> \par Purpose:
36* =============
37*>
38*> \verbatim
39*>
40*> CLAGTM performs a matrix-matrix product of the form
41*>
42*> B := alpha * A * X + beta * B
43*>
44*> where A is a tridiagonal matrix of order N, B and X are N by NRHS
45*> matrices, and alpha and beta are real scalars, each of which may be
46*> 0., 1., or -1.
47*> \endverbatim
48*
49* Arguments:
50* ==========
51*
52*> \param[in] TRANS
53*> \verbatim
54*> TRANS is CHARACTER*1
55*> Specifies the operation applied to A.
56*> = 'N': No transpose, B := alpha * A * X + beta * B
57*> = 'T': Transpose, B := alpha * A**T * X + beta * B
58*> = 'C': Conjugate transpose, B := alpha * A**H * X + beta * B
59*> \endverbatim
60*>
61*> \param[in] N
62*> \verbatim
63*> N is INTEGER
64*> The order of the matrix A. N >= 0.
65*> \endverbatim
66*>
67*> \param[in] NRHS
68*> \verbatim
69*> NRHS is INTEGER
70*> The number of right hand sides, i.e., the number of columns
71*> of the matrices X and B.
72*> \endverbatim
73*>
74*> \param[in] ALPHA
75*> \verbatim
76*> ALPHA is REAL
77*> The scalar alpha. ALPHA must be 0., 1., or -1.; otherwise,
78*> it is assumed to be 0.
79*> \endverbatim
80*>
81*> \param[in] DL
82*> \verbatim
83*> DL is COMPLEX array, dimension (N-1)
84*> The (n-1) sub-diagonal elements of T.
85*> \endverbatim
86*>
87*> \param[in] D
88*> \verbatim
89*> D is COMPLEX array, dimension (N)
90*> The diagonal elements of T.
91*> \endverbatim
92*>
93*> \param[in] DU
94*> \verbatim
95*> DU is COMPLEX array, dimension (N-1)
96*> The (n-1) super-diagonal elements of T.
97*> \endverbatim
98*>
99*> \param[in] X
100*> \verbatim
101*> X is COMPLEX array, dimension (LDX,NRHS)
102*> The N by NRHS matrix X.
103*> \endverbatim
104*>
105*> \param[in] LDX
106*> \verbatim
107*> LDX is INTEGER
108*> The leading dimension of the array X. LDX >= max(N,1).
109*> \endverbatim
110*>
111*> \param[in] BETA
112*> \verbatim
113*> BETA is REAL
114*> The scalar beta. BETA must be 0., 1., or -1.; otherwise,
115*> it is assumed to be 1.
116*> \endverbatim
117*>
118*> \param[in,out] B
119*> \verbatim
120*> B is COMPLEX array, dimension (LDB,NRHS)
121*> On entry, the N by NRHS matrix B.
122*> On exit, B is overwritten by the matrix expression
123*> B := alpha * A * X + beta * B.
124*> \endverbatim
125*>
126*> \param[in] LDB
127*> \verbatim
128*> LDB is INTEGER
129*> The leading dimension of the array B. LDB >= max(N,1).
130*> \endverbatim
131*
132* Authors:
133* ========
134*
135*> \author Univ. of Tennessee
136*> \author Univ. of California Berkeley
137*> \author Univ. of Colorado Denver
138*> \author NAG Ltd.
139*
140*> \ingroup lagtm
141*
142* =====================================================================
143 SUBROUTINE clagtm( TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX, BETA,
144 $ B, LDB )
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*
318 END
subroutine clagtm(trans, n, nrhs, alpha, dl, d, du, x, ldx, beta, b, ldb)
CLAGTM performs a matrix-matrix product of the form C = αAB+βC, where A is a tridiagonal matrix,...
Definition clagtm.f:145