LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dlagtm.f
Go to the documentation of this file.
1*> \brief \b DLAGTM 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*> Download DLAGTM + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlagtm.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlagtm.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlagtm.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DLAGTM( TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX, BETA,
20* B, LDB )
21*
22* .. Scalar Arguments ..
23* CHARACTER TRANS
24* INTEGER LDB, LDX, N, NRHS
25* DOUBLE PRECISION ALPHA, BETA
26* ..
27* .. Array Arguments ..
28* DOUBLE PRECISION B( LDB, * ), D( * ), DL( * ), DU( * ),
29* $ X( LDX, * )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> DLAGTM performs a matrix-matrix product of the form
39*>
40*> B := alpha * A * X + beta * B
41*>
42*> where A is a tridiagonal matrix of order N, B and X are N by NRHS
43*> matrices, and alpha and beta are real scalars, each of which may be
44*> 0., 1., or -1.
45*> \endverbatim
46*
47* Arguments:
48* ==========
49*
50*> \param[in] TRANS
51*> \verbatim
52*> TRANS is CHARACTER*1
53*> Specifies the operation applied to A.
54*> = 'N': No transpose, B := alpha * A * X + beta * B
55*> = 'T': Transpose, B := alpha * A'* X + beta * B
56*> = 'C': Conjugate transpose = Transpose
57*> \endverbatim
58*>
59*> \param[in] N
60*> \verbatim
61*> N is INTEGER
62*> The order of the matrix A. N >= 0.
63*> \endverbatim
64*>
65*> \param[in] NRHS
66*> \verbatim
67*> NRHS is INTEGER
68*> The number of right hand sides, i.e., the number of columns
69*> of the matrices X and B.
70*> \endverbatim
71*>
72*> \param[in] ALPHA
73*> \verbatim
74*> ALPHA is DOUBLE PRECISION
75*> The scalar alpha. ALPHA must be 0., 1., or -1.; otherwise,
76*> it is assumed to be 0.
77*> \endverbatim
78*>
79*> \param[in] DL
80*> \verbatim
81*> DL is DOUBLE PRECISION array, dimension (N-1)
82*> The (n-1) sub-diagonal elements of T.
83*> \endverbatim
84*>
85*> \param[in] D
86*> \verbatim
87*> D is DOUBLE PRECISION array, dimension (N)
88*> The diagonal elements of T.
89*> \endverbatim
90*>
91*> \param[in] DU
92*> \verbatim
93*> DU is DOUBLE PRECISION array, dimension (N-1)
94*> The (n-1) super-diagonal elements of T.
95*> \endverbatim
96*>
97*> \param[in] X
98*> \verbatim
99*> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
100*> The N by NRHS matrix X.
101*> \endverbatim
102*>
103*> \param[in] LDX
104*> \verbatim
105*> LDX is INTEGER
106*> The leading dimension of the array X. LDX >= max(N,1).
107*> \endverbatim
108*>
109*> \param[in] BETA
110*> \verbatim
111*> BETA is DOUBLE PRECISION
112*> The scalar beta. BETA must be 0., 1., or -1.; otherwise,
113*> it is assumed to be 1.
114*> \endverbatim
115*>
116*> \param[in,out] B
117*> \verbatim
118*> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
119*> On entry, the N by NRHS matrix B.
120*> On exit, B is overwritten by the matrix expression
121*> B := alpha * A * X + beta * B.
122*> \endverbatim
123*>
124*> \param[in] LDB
125*> \verbatim
126*> LDB is INTEGER
127*> The leading dimension of the array B. LDB >= max(N,1).
128*> \endverbatim
129*
130* Authors:
131* ========
132*
133*> \author Univ. of Tennessee
134*> \author Univ. of California Berkeley
135*> \author Univ. of Colorado Denver
136*> \author NAG Ltd.
137*
138*> \ingroup lagtm
139*
140* =====================================================================
141 SUBROUTINE dlagtm( TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX,
142 $ BETA,
143 $ B, LDB )
144*
145* -- LAPACK auxiliary routine --
146* -- LAPACK is a software package provided by Univ. of Tennessee, --
147* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
148*
149* .. Scalar Arguments ..
150 CHARACTER TRANS
151 INTEGER LDB, LDX, N, NRHS
152 DOUBLE PRECISION ALPHA, BETA
153* ..
154* .. Array Arguments ..
155 DOUBLE PRECISION B( LDB, * ), D( * ), DL( * ), DU( * ),
156 $ X( LDX, * )
157* ..
158*
159* =====================================================================
160*
161* .. Parameters ..
162 DOUBLE PRECISION ONE, ZERO
163 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0 )
164* ..
165* .. Local Scalars ..
166 INTEGER I, J
167* ..
168* .. External Functions ..
169 LOGICAL LSAME
170 EXTERNAL LSAME
171* ..
172* .. Executable Statements ..
173*
174 IF( n.EQ.0 )
175 $ RETURN
176*
177* Multiply B by BETA if BETA.NE.1.
178*
179 IF( beta.EQ.zero ) THEN
180 DO 20 j = 1, nrhs
181 DO 10 i = 1, n
182 b( i, j ) = zero
183 10 CONTINUE
184 20 CONTINUE
185 ELSE IF( beta.EQ.-one ) THEN
186 DO 40 j = 1, nrhs
187 DO 30 i = 1, n
188 b( i, j ) = -b( i, j )
189 30 CONTINUE
190 40 CONTINUE
191 END IF
192*
193 IF( alpha.EQ.one ) THEN
194 IF( lsame( trans, 'N' ) ) THEN
195*
196* Compute B := B + A*X
197*
198 DO 60 j = 1, nrhs
199 IF( n.EQ.1 ) THEN
200 b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j )
201 ELSE
202 b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j ) +
203 $ du( 1 )*x( 2, j )
204 b( n, j ) = b( n, j ) + dl( n-1 )*x( n-1, j ) +
205 $ d( n )*x( n, j )
206 DO 50 i = 2, n - 1
207 b( i, j ) = b( i, j ) + dl( i-1 )*x( i-1, j ) +
208 $ d( i )*x( i, j ) + du( i )*x( i+1, j )
209 50 CONTINUE
210 END IF
211 60 CONTINUE
212 ELSE
213*
214* Compute B := B + A**T*X
215*
216 DO 80 j = 1, nrhs
217 IF( n.EQ.1 ) THEN
218 b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j )
219 ELSE
220 b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j ) +
221 $ dl( 1 )*x( 2, j )
222 b( n, j ) = b( n, j ) + du( n-1 )*x( n-1, j ) +
223 $ d( n )*x( n, j )
224 DO 70 i = 2, n - 1
225 b( i, j ) = b( i, j ) + du( i-1 )*x( i-1, j ) +
226 $ d( i )*x( i, j ) + dl( i )*x( i+1, j )
227 70 CONTINUE
228 END IF
229 80 CONTINUE
230 END IF
231 ELSE IF( alpha.EQ.-one ) THEN
232 IF( lsame( trans, 'N' ) ) THEN
233*
234* Compute B := B - A*X
235*
236 DO 100 j = 1, nrhs
237 IF( n.EQ.1 ) THEN
238 b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j )
239 ELSE
240 b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j ) -
241 $ du( 1 )*x( 2, j )
242 b( n, j ) = b( n, j ) - dl( n-1 )*x( n-1, j ) -
243 $ d( n )*x( n, j )
244 DO 90 i = 2, n - 1
245 b( i, j ) = b( i, j ) - dl( i-1 )*x( i-1, j ) -
246 $ d( i )*x( i, j ) - du( i )*x( i+1, j )
247 90 CONTINUE
248 END IF
249 100 CONTINUE
250 ELSE
251*
252* Compute B := B - A**T*X
253*
254 DO 120 j = 1, nrhs
255 IF( n.EQ.1 ) THEN
256 b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j )
257 ELSE
258 b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j ) -
259 $ dl( 1 )*x( 2, j )
260 b( n, j ) = b( n, j ) - du( n-1 )*x( n-1, j ) -
261 $ d( n )*x( n, j )
262 DO 110 i = 2, n - 1
263 b( i, j ) = b( i, j ) - du( i-1 )*x( i-1, j ) -
264 $ d( i )*x( i, j ) - dl( i )*x( i+1, j )
265 110 CONTINUE
266 END IF
267 120 CONTINUE
268 END IF
269 END IF
270 RETURN
271*
272* End of DLAGTM
273*
274 END
subroutine dlagtm(trans, n, nrhs, alpha, dl, d, du, x, ldx, beta, b, ldb)
DLAGTM performs a matrix-matrix product of the form C = αAB+βC, where A is a tridiagonal matrix,...
Definition dlagtm.f:144