LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

◆ zgbtrs()

subroutine zgbtrs ( character trans,
integer n,
integer kl,
integer ku,
integer nrhs,
complex*16, dimension( ldab, * ) ab,
integer ldab,
integer, dimension( * ) ipiv,
complex*16, dimension( ldb, * ) b,
integer ldb,
integer info )

ZGBTRS

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

Purpose:
!> !> ZGBTRS 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 ZGBTRF. !>
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*16 array, dimension (LDAB,N) !> Details of the LU factorization of the band matrix A, as !> computed by ZGBTRF. 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*16 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.

Definition at line 134 of file zgbtrs.f.

137*
138* -- LAPACK computational routine --
139* -- LAPACK is a software package provided by Univ. of Tennessee, --
140* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
141*
142* .. Scalar Arguments ..
143 CHARACTER TRANS
144 INTEGER INFO, KL, KU, LDAB, LDB, N, NRHS
145* ..
146* .. Array Arguments ..
147 INTEGER IPIV( * )
148 COMPLEX*16 AB( LDAB, * ), B( LDB, * )
149* ..
150*
151* =====================================================================
152*
153* .. Parameters ..
154 COMPLEX*16 ONE
155 parameter( one = ( 1.0d+0, 0.0d+0 ) )
156* ..
157* .. Local Scalars ..
158 LOGICAL LNOTI, NOTRAN
159 INTEGER I, J, KD, L, LM
160* ..
161* .. External Functions ..
162 LOGICAL LSAME
163 EXTERNAL lsame
164* ..
165* .. External Subroutines ..
166 EXTERNAL xerbla, zgemv, zgeru, zlacgv, zswap,
167 $ ztbsv
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC max, min
171* ..
172* .. Executable Statements ..
173*
174* Test the input parameters.
175*
176 info = 0
177 notran = lsame( trans, 'N' )
178 IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
179 $ lsame( trans, 'C' ) ) THEN
180 info = -1
181 ELSE IF( n.LT.0 ) THEN
182 info = -2
183 ELSE IF( kl.LT.0 ) THEN
184 info = -3
185 ELSE IF( ku.LT.0 ) THEN
186 info = -4
187 ELSE IF( nrhs.LT.0 ) THEN
188 info = -5
189 ELSE IF( ldab.LT.( 2*kl+ku+1 ) ) THEN
190 info = -7
191 ELSE IF( ldb.LT.max( 1, n ) ) THEN
192 info = -10
193 END IF
194 IF( info.NE.0 ) THEN
195 CALL xerbla( 'ZGBTRS', -info )
196 RETURN
197 END IF
198*
199* Quick return if possible
200*
201 IF( n.EQ.0 .OR. nrhs.EQ.0 )
202 $ RETURN
203*
204 kd = ku + kl + 1
205 lnoti = kl.GT.0
206*
207 IF( notran ) THEN
208*
209* Solve A*X = B.
210*
211* Solve L*X = B, overwriting B with X.
212*
213* L is represented as a product of permutations and unit lower
214* triangular matrices L = P(1) * L(1) * ... * P(n-1) * L(n-1),
215* where each transformation L(i) is a rank-one modification of
216* the identity matrix.
217*
218 IF( lnoti ) THEN
219 DO 10 j = 1, n - 1
220 lm = min( kl, n-j )
221 l = ipiv( j )
222 IF( l.NE.j )
223 $ CALL zswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
224 CALL zgeru( lm, nrhs, -one, ab( kd+1, j ), 1, b( j,
225 $ 1 ),
226 $ ldb, b( j+1, 1 ), ldb )
227 10 CONTINUE
228 END IF
229*
230 DO 20 i = 1, nrhs
231*
232* Solve U*X = B, overwriting B with X.
233*
234 CALL ztbsv( 'Upper', 'No transpose', 'Non-unit', n,
235 $ kl+ku,
236 $ ab, ldab, b( 1, i ), 1 )
237 20 CONTINUE
238*
239 ELSE IF( lsame( trans, 'T' ) ) THEN
240*
241* Solve A**T * X = B.
242*
243 DO 30 i = 1, nrhs
244*
245* Solve U**T * X = B, overwriting B with X.
246*
247 CALL ztbsv( 'Upper', 'Transpose', 'Non-unit', n, kl+ku,
248 $ 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 zgemv( '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 zswap( 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 ztbsv( 'Upper', 'Conjugate transpose', 'Non-unit',
274 $ n,
275 $ kl+ku, ab, ldab, b( 1, i ), 1 )
276 50 CONTINUE
277*
278* Solve L**H * X = B, overwriting B with X.
279*
280 IF( lnoti ) THEN
281 DO 60 j = n - 1, 1, -1
282 lm = min( kl, n-j )
283 CALL zlacgv( nrhs, b( j, 1 ), ldb )
284 CALL zgemv( 'Conjugate transpose', lm, nrhs, -one,
285 $ b( j+1, 1 ), ldb, ab( kd+1, j ), 1, one,
286 $ b( j, 1 ), ldb )
287 CALL zlacgv( nrhs, b( j, 1 ), ldb )
288 l = ipiv( j )
289 IF( l.NE.j )
290 $ CALL zswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
291 60 CONTINUE
292 END IF
293 END IF
294 RETURN
295*
296* End of ZGBTRS
297*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
Definition zgemv.f:160
subroutine zgeru(m, n, alpha, x, incx, y, incy, a, lda)
ZGERU
Definition zgeru.f:130
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
Definition zlacgv.f:72
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81
subroutine ztbsv(uplo, trans, diag, n, k, a, lda, x, incx)
ZTBSV
Definition ztbsv.f:189
Here is the call graph for this function:
Here is the caller graph for this function: