# ?gbsv

Computes the solution to the system of linear equations with a band matrix A and multiple right-hand sides.

## Syntax

FORTRAN 77:

call sgbsv( n, kl, ku, nrhs, ab, ldab, ipiv, b, ldb, info )

call dgbsv( n, kl, ku, nrhs, ab, ldab, ipiv, b, ldb, info )

call cgbsv( n, kl, ku, nrhs, ab, ldab, ipiv, b, ldb, info )

call zgbsv( n, kl, ku, nrhs, ab, ldab, ipiv, b, ldb, info )

Fortran 95:

call gbsv( a, b [,kl] [,ipiv] [,info] )

## Description

This routine solves for X the real or complex system of linear equations `A*X = B`, where A is an n-by-n band matrix with kl subdiagonals and ku superdiagonals, the columns of matrix B are individual right-hand sides, and the columns of X are the corresponding solutions.

The LU decomposition with partial pivoting and row interchanges is used to factor A as A = L*U, where L is a product of permutation and unit lower triangular matrices with kl subdiagonals, and U is upper triangular with kl+ku superdiagonals. The factored form of A is then used to solve the system of equations `A*X = B`.

## Input Parameters

n

  INTEGER. The order of A. The number of rows in B; n ≥ 0.

kl

  INTEGER. The number of subdiagonals within the band of A; kl ≥ 0.

ku

  INTEGER. The number of superdiagonals within the band of A; ku ≥ 0.

nrhs

  INTEGER. The number of right-hand sides. The number of columns in B; nrhs ≥ 0.

ab, b

  REAL for sgbsv

  DOUBLE PRECISION for dgbsv

  COMPLEX for cgbsv

  DOUBLE COMPLEX for zgbsv.

  Arrays: `ab(ldab,*)`, `b(ldb,*)`.

  The array ab contains the matrix A in band storage (see Matrix Storage Schemes). The second dimension of ab must be at least `max(1, n)`.

  The array b contains the matrix B whose columns are the right-hand sides for the systems of equations. The second dimension of b must be at least `max(1,nrhs)`.

ldab

  INTEGER. The first dimension of the array ab. (ldab ≥ 2kl + ku +1)

ldb

  INTEGER. The first dimension of b; `ldb ≥ max(1, n)`.

## Output Parameters

ab

  Overwritten by L and U. The diagonal and kl + ku superdiagonals of U are stored in the first 1 + kl + ku rows of ab. The multipliers used to form L are stored in the next kl rows.

b

  Overwritten by the solution matrix X.

ipiv

  INTEGER.

  Array, DIMENSION at least `max(1, n)`. The pivot indices: row i was interchanged with row `ipiv(i)`.

info

  INTEGER. If `info = 0`, the execution is successful.

  If `info = -i`, the i-th parameter had an illegal value.

  If `info = i`, U(i, i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their Fortran 77 counterparts. For general conventions applied to skip redundant or reconstructible arguments, see Fortran 95 Interface Conventions.

Specific details for the routine gbsv interface are as follows:

a

  Stands for argument ab in Fortan 77 interface. Holds the array A of size (`2*kl+ku+1,n`).

b

  Holds the matrix B of size (`n,nrhs`).

ipiv

  Holds the vector of length (n).

kl

  If omitted, assumed `kl = ku`.

ku

  Restored as `ku = lda-2*kl-1`.

Parent topic: Driver Routines