LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ cgbtrs()

subroutine cgbtrs ( character  TRANS,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
complex, dimension( ldab, * )  AB,
integer  LDAB,
integer, dimension( * )  IPIV,
complex, dimension( ldb, * )  B,
integer  LDB,
integer  INFO 
)

CGBTRS

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

Purpose:
 CGBTRS solves a system of linear equations
    A * X = B,  A**T * X = B,  or  A**H * X = B
 with a general band matrix A using the LU factorization computed
 by CGBTRF.
Parameters
[in]TRANS
          TRANS is CHARACTER*1
          Specifies the form of the system of equations.
          = 'N':  A * X = B     (No transpose)
          = 'T':  A**T * X = B  (Transpose)
          = 'C':  A**H * X = B  (Conjugate transpose)
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 0.
[in]NRHS
          NRHS is INTEGER
          The number of right hand sides, i.e., the number of columns
          of the matrix B.  NRHS >= 0.
[in]AB
          AB is COMPLEX array, dimension (LDAB,N)
          Details of the LU factorization of the band matrix A, as
          computed by CGBTRF.  U is stored as an upper triangular band
          matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
          the multipliers used during the factorization are stored in
          rows KL+KU+2 to 2*KL+KU+1.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= 2*KL+KU+1.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices; for 1 <= i <= N, row i of the matrix was
          interchanged with row IPIV(i).
[in,out]B
          B is COMPLEX array, dimension (LDB,NRHS)
          On entry, the right hand side matrix B.
          On exit, the solution matrix X.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 140 of file cgbtrs.f.

140 *
141 * -- LAPACK computational routine (version 3.7.0) --
142 * -- LAPACK is a software package provided by Univ. of Tennessee, --
143 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
144 * December 2016
145 *
146 * .. Scalar Arguments ..
147  CHARACTER trans
148  INTEGER info, kl, ku, ldab, ldb, n, nrhs
149 * ..
150 * .. Array Arguments ..
151  INTEGER ipiv( * )
152  COMPLEX ab( ldab, * ), b( ldb, * )
153 * ..
154 *
155 * =====================================================================
156 *
157 * .. Parameters ..
158  COMPLEX one
159  parameter( one = ( 1.0e+0, 0.0e+0 ) )
160 * ..
161 * .. Local Scalars ..
162  LOGICAL lnoti, notran
163  INTEGER i, j, kd, l, lm
164 * ..
165 * .. External Functions ..
166  LOGICAL lsame
167  EXTERNAL lsame
168 * ..
169 * .. External Subroutines ..
170  EXTERNAL cgemv, cgeru, clacgv, cswap, ctbsv, xerbla
171 * ..
172 * .. Intrinsic Functions ..
173  INTRINSIC max, min
174 * ..
175 * .. Executable Statements ..
176 *
177 * Test the input parameters.
178 *
179  info = 0
180  notran = lsame( trans, 'N' )
181  IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
182  $ lsame( trans, 'C' ) ) THEN
183  info = -1
184  ELSE IF( n.LT.0 ) THEN
185  info = -2
186  ELSE IF( kl.LT.0 ) THEN
187  info = -3
188  ELSE IF( ku.LT.0 ) THEN
189  info = -4
190  ELSE IF( nrhs.LT.0 ) THEN
191  info = -5
192  ELSE IF( ldab.LT.( 2*kl+ku+1 ) ) THEN
193  info = -7
194  ELSE IF( ldb.LT.max( 1, n ) ) THEN
195  info = -10
196  END IF
197  IF( info.NE.0 ) THEN
198  CALL xerbla( 'CGBTRS', -info )
199  RETURN
200  END IF
201 *
202 * Quick return if possible
203 *
204  IF( n.EQ.0 .OR. nrhs.EQ.0 )
205  $ RETURN
206 *
207  kd = ku + kl + 1
208  lnoti = kl.GT.0
209 *
210  IF( notran ) THEN
211 *
212 * Solve A*X = B.
213 *
214 * Solve L*X = B, overwriting B with X.
215 *
216 * L is represented as a product of permutations and unit lower
217 * triangular matrices L = P(1) * L(1) * ... * P(n-1) * L(n-1),
218 * where each transformation L(i) is a rank-one modification of
219 * the identity matrix.
220 *
221  IF( lnoti ) THEN
222  DO 10 j = 1, n - 1
223  lm = min( kl, n-j )
224  l = ipiv( j )
225  IF( l.NE.j )
226  $ CALL cswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
227  CALL cgeru( lm, nrhs, -one, ab( kd+1, j ), 1, b( j, 1 ),
228  $ ldb, b( j+1, 1 ), ldb )
229  10 CONTINUE
230  END IF
231 *
232  DO 20 i = 1, nrhs
233 *
234 * Solve U*X = B, overwriting B with X.
235 *
236  CALL ctbsv( 'Upper', 'No transpose', 'Non-unit', n, kl+ku,
237  $ ab, ldab, b( 1, i ), 1 )
238  20 CONTINUE
239 *
240  ELSE IF( lsame( trans, 'T' ) ) THEN
241 *
242 * Solve A**T * X = B.
243 *
244  DO 30 i = 1, nrhs
245 *
246 * Solve U**T * X = B, overwriting B with X.
247 *
248  CALL ctbsv( 'Upper', 'Transpose', 'Non-unit', n, kl+ku, ab,
249  $ ldab, b( 1, i ), 1 )
250  30 CONTINUE
251 *
252 * Solve L**T * X = B, overwriting B with X.
253 *
254  IF( lnoti ) THEN
255  DO 40 j = n - 1, 1, -1
256  lm = min( kl, n-j )
257  CALL cgemv( 'Transpose', lm, nrhs, -one, b( j+1, 1 ),
258  $ ldb, ab( kd+1, j ), 1, one, b( j, 1 ), ldb )
259  l = ipiv( j )
260  IF( l.NE.j )
261  $ CALL cswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
262  40 CONTINUE
263  END IF
264 *
265  ELSE
266 *
267 * Solve A**H * X = B.
268 *
269  DO 50 i = 1, nrhs
270 *
271 * Solve U**H * X = B, overwriting B with X.
272 *
273  CALL ctbsv( 'Upper', 'Conjugate transpose', 'Non-unit', n,
274  $ kl+ku, ab, ldab, b( 1, i ), 1 )
275  50 CONTINUE
276 *
277 * Solve L**H * X = B, overwriting B with X.
278 *
279  IF( lnoti ) THEN
280  DO 60 j = n - 1, 1, -1
281  lm = min( kl, n-j )
282  CALL clacgv( nrhs, b( j, 1 ), ldb )
283  CALL cgemv( 'Conjugate transpose', lm, nrhs, -one,
284  $ b( j+1, 1 ), ldb, ab( kd+1, j ), 1, one,
285  $ b( j, 1 ), ldb )
286  CALL clacgv( nrhs, b( j, 1 ), ldb )
287  l = ipiv( j )
288  IF( l.NE.j )
289  $ CALL cswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
290  60 CONTINUE
291  END IF
292  END IF
293  RETURN
294 *
295 * End of CGBTRS
296 *
subroutine cgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CGEMV
Definition: cgemv.f:160
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine clacgv(N, X, INCX)
CLACGV conjugates a complex vector.
Definition: clacgv.f:76
subroutine cswap(N, CX, INCX, CY, INCY)
CSWAP
Definition: cswap.f:83
subroutine ctbsv(UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX)
CTBSV
Definition: ctbsv.f:191
subroutine cgeru(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
CGERU
Definition: cgeru.f:132
Here is the call graph for this function:
Here is the caller graph for this function: