# ?tbsv

Solves a system of linear equations whose coefficients are in a triangular band matrix.

## Syntax

FORTRAN 77:

call stbsv(uplo, trans, diag, n, k, a, lda, x, incx )

call dtbsv(uplo, trans, diag, n, k, a, lda, x, incx )

call ctbsv(uplo, trans, diag, n, k, a, lda, x, incx )

call ztbsv(uplo, trans, diag, n, k, a, lda, x, incx )

Fortran 95:

call tbsv(a, x [,uplo] [, trans] [,diag])

## Description

The ?tbsv routines solve one of the following systems of equations:

`A*x = b`, or `A'*x = b, or conjg(A')*x = b`,

where:

b and x are n-element vectors,

A is an n-by-n unit, or non-unit, upper or lower triangular band matrix, with `(k + 1)` diagonals.

The routine does not test for singularity or near-singularity.

Such tests must be performed before calling this routine.

## Input Parameters

uplo

  CHARACTER*1. Specifies whether the matrix A is an upper or lower triangular matrix:

  if `uplo = 'U'` or 'u' the matrix is upper triangular;

  if `uplo = 'L'` or 'l', the matrix is low triangular.

trans

  CHARACTER*1. Specifies the system of equations:

  if `trans = 'N'` or `'n'`, then `A*x = b`;

  if `trans = 'T'` or `'t'`, then `A'*x = b`;

  if `trans = 'C'` or `'c'`, then `conjg(A')*x = b`.

diag

  CHARACTER*1. Specifies whether the matrix A is unit triangular:

  if `diag = 'U'` or 'u' then the matrix is unit triangular;

  if `diag = 'N'` or 'n', then the matrix is not unit triangular.

n

  INTEGER. Specifies the order of the matrix A. The value of n must be at least zero.

k

  INTEGER. On entry with `uplo = 'U'` or 'u', k specifies the number of super-diagonals of the matrix A. On entry with `uplo = 'L'` or 'l', k specifies the number of sub-diagonals of the matrix A.

  The value of k must satisfy `0` ≤ k.

a

  REAL for stbsv

  DOUBLE PRECISION for dtbsv

  COMPLEX for ctbsv

  DOUBLE COMPLEX for ztbsv

  Array, DIMENSION `(lda, n)`.

  Before entry with `uplo = 'U'` or 'u', the leading `(k + 1)` by n part of the array a must contain the upper triangular band part of the matrix of coefficients, supplied column-by-column, with the leading diagonal of the matrix in row `(k + 1)` of the array, the first super-diagonal starting at position 2 in row k, and so on. The top left k by k triangle of the array a is not referenced.

  The following program segment transfers an upper triangular band matrix from conventional full matrix storage to band storage:
  `do 20, j = 1, n`
  `m = k + 1 - j`
  `do 10, i = max(1, j - k), jl`
  `a(m + i, j) = matrix (i, j)`
  `10 continue`
  `20 continue`

  Before entry with `uplo = 'L'` or 'l', the leading `(k + 1)` by n part of the array a must contain the lower triangular band part of the matrix of coefficients, supplied column-by-column, with the leading diagonal of the matrix in row 1 of the array, the first sub-diagonal starting at position 1 in row 2, and so on. The bottom right k by k triangle of the array a is not referenced.

  The following program segment transfers a lower triangular band matrix from conventional full matrix storage to band storage:
  `do 20, j = 1, n`
  `m = 1 - j`
  `do 10, i = j, min(n, j + k)`
  `a(m + i, j) = matrix (i, j)`
  `10 continue`
  `20 continue`

  When `diag = 'U'` or 'u', the elements of the array a corresponding to the diagonal elements of the matrix are not referenced, but are assumed to be unity.

lda

  INTEGER. Specifies the first dimension of a as declared in the calling (sub)program. The value of lda must be at least `(k + 1)`.

x

  REAL for stbsv

  DOUBLE PRECISION for dtbsv

  COMPLEX for ctbsv

  DOUBLE COMPLEX for ztbsv

  Array, DIMENSION at least `(1 + (n - 1)*abs(incx))`. Before entry, the incremented array x must contain the n-element right-hand side vector b.

incx

  INTEGER. Specifies the increment for the elements of x.

  The value of incx must not be zero.

## Output Parameters

x

  Overwritten with the solution vector x.

## 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 tbsv interface are the following:

a

  Holds the array a of size (k+1,n).

x

  Holds the vector of length (n).

uplo

  Must be 'U' or 'L'. The default value is 'U'.

trans

  Must be 'N', 'C', or 'T'.

  The default value is 'N'.

diag

  Must be 'N' or 'U'. The default value is 'N'.

Parent topic: BLAS Level 2 Routines