LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ slagtm()

subroutine slagtm ( character  TRANS,
integer  N,
integer  NRHS,
real  ALPHA,
real, dimension( * )  DL,
real, dimension( * )  D,
real, dimension( * )  DU,
real, dimension( ldx, * )  X,
integer  LDX,
real  BETA,
real, dimension( ldb, * )  B,
integer  LDB 
)

SLAGTM 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 SLAGTM + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 SLAGTM performs a matrix-vector 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 REAL
          The scalar alpha.  ALPHA must be 0., 1., or -1.; otherwise,
          it is assumed to be 0.
[in]DL
          DL is REAL array, dimension (N-1)
          The (n-1) sub-diagonal elements of T.
[in]D
          D is REAL array, dimension (N)
          The diagonal elements of T.
[in]DU
          DU is REAL array, dimension (N-1)
          The (n-1) super-diagonal elements of T.
[in]X
          X is REAL 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 REAL 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 slagtm.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  REAL 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 * .. Executable Statements ..
174 *
175  IF( n.EQ.0 )
176  $ RETURN
177 *
178 * Multiply B by BETA if BETA.NE.1.
179 *
180  IF( beta.EQ.zero ) THEN
181  DO 20 j = 1, nrhs
182  DO 10 i = 1, n
183  b( i, j ) = zero
184  10 CONTINUE
185  20 CONTINUE
186  ELSE IF( beta.EQ.-one ) THEN
187  DO 40 j = 1, nrhs
188  DO 30 i = 1, n
189  b( i, j ) = -b( i, j )
190  30 CONTINUE
191  40 CONTINUE
192  END IF
193 *
194  IF( alpha.EQ.one ) THEN
195  IF( lsame( trans, 'N' ) ) THEN
196 *
197 * Compute B := B + A*X
198 *
199  DO 60 j = 1, nrhs
200  IF( n.EQ.1 ) THEN
201  b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j )
202  ELSE
203  b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j ) +
204  $ du( 1 )*x( 2, j )
205  b( n, j ) = b( n, j ) + dl( n-1 )*x( n-1, j ) +
206  $ d( n )*x( n, j )
207  DO 50 i = 2, n - 1
208  b( i, j ) = b( i, j ) + dl( i-1 )*x( i-1, j ) +
209  $ d( i )*x( i, j ) + du( i )*x( i+1, j )
210  50 CONTINUE
211  END IF
212  60 CONTINUE
213  ELSE
214 *
215 * Compute B := B + A**T*X
216 *
217  DO 80 j = 1, nrhs
218  IF( n.EQ.1 ) THEN
219  b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j )
220  ELSE
221  b( 1, j ) = b( 1, j ) + d( 1 )*x( 1, j ) +
222  $ dl( 1 )*x( 2, j )
223  b( n, j ) = b( n, j ) + du( n-1 )*x( n-1, j ) +
224  $ d( n )*x( n, j )
225  DO 70 i = 2, n - 1
226  b( i, j ) = b( i, j ) + du( i-1 )*x( i-1, j ) +
227  $ d( i )*x( i, j ) + dl( i )*x( i+1, j )
228  70 CONTINUE
229  END IF
230  80 CONTINUE
231  END IF
232  ELSE IF( alpha.EQ.-one ) THEN
233  IF( lsame( trans, 'N' ) ) THEN
234 *
235 * Compute B := B - A*X
236 *
237  DO 100 j = 1, nrhs
238  IF( n.EQ.1 ) THEN
239  b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j )
240  ELSE
241  b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j ) -
242  $ du( 1 )*x( 2, j )
243  b( n, j ) = b( n, j ) - dl( n-1 )*x( n-1, j ) -
244  $ d( n )*x( n, j )
245  DO 90 i = 2, n - 1
246  b( i, j ) = b( i, j ) - dl( i-1 )*x( i-1, j ) -
247  $ d( i )*x( i, j ) - du( i )*x( i+1, j )
248  90 CONTINUE
249  END IF
250  100 CONTINUE
251  ELSE
252 *
253 * Compute B := B - A**T*X
254 *
255  DO 120 j = 1, nrhs
256  IF( n.EQ.1 ) THEN
257  b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j )
258  ELSE
259  b( 1, j ) = b( 1, j ) - d( 1 )*x( 1, j ) -
260  $ dl( 1 )*x( 2, j )
261  b( n, j ) = b( n, j ) - du( n-1 )*x( n-1, j ) -
262  $ d( n )*x( n, j )
263  DO 110 i = 2, n - 1
264  b( i, j ) = b( i, j ) - du( i-1 )*x( i-1, j ) -
265  $ d( i )*x( i, j ) - dl( i )*x( i+1, j )
266  110 CONTINUE
267  END IF
268  120 CONTINUE
269  END IF
270  END IF
271  RETURN
272 *
273 * End of SLAGTM
274 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
Here is the caller graph for this function: