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

◆ dlagtm()

subroutine dlagtm ( character trans,
integer n,
integer nrhs,
double precision alpha,
double precision, dimension( * ) dl,
double precision, dimension( * ) d,
double precision, dimension( * ) du,
double precision, dimension( ldx, * ) x,
integer ldx,
double precision beta,
double precision, dimension( ldb, * ) b,
integer ldb )

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.

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

Purpose:
!>
!> DLAGTM 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'* X + beta * B
!>          = 'C':  Conjugate transpose = Transpose
!> 
[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 DOUBLE PRECISION
!>          The scalar alpha.  ALPHA must be 0., 1., or -1.; otherwise,
!>          it is assumed to be 0.
!> 
[in]DL
!>          DL is DOUBLE PRECISION array, dimension (N-1)
!>          The (n-1) sub-diagonal elements of T.
!> 
[in]D
!>          D is DOUBLE PRECISION array, dimension (N)
!>          The diagonal elements of T.
!> 
[in]DU
!>          DU is DOUBLE PRECISION array, dimension (N-1)
!>          The (n-1) super-diagonal elements of T.
!> 
[in]X
!>          X is DOUBLE PRECISION 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 DOUBLE PRECISION
!>          The scalar beta.  BETA must be 0., 1., or -1.; otherwise,
!>          it is assumed to be 1.
!> 
[in,out]B
!>          B is DOUBLE PRECISION 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 141 of file dlagtm.f.

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*
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the caller graph for this function: