我要评分
获取效率
正确性
完整性
易理解

?tbsv

Solves linear equations. The sparse matrix is a triangular band matrix.

, or

b and x are vectors including n elements, and A is a band matrix including n x n elements or non-elements, the upper triangle, or the lower triangle.

Interface Definition

C interface:

void cblas_stbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const blasint N, const blasint K, const float *A, const blasint lda, float *X, const blasint incX);

void cblas_dtbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const blasint N, const blasint K, const double *A, const blasint lda, double *X, const blasint incX);

void cblas_ctbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const blasint N, const blasint K, const void *A, const blasint lda, void *X, const blasint incX);

void cblas_ztbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLOUplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const blasint N, const blasint K, const void* A, const blasint lda, void *X, const blasint incX);

Fortran interface:

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)

Parameters

Parameter

Type

Description

Input/Output

order

Enumeration type CBLAS_ORDER

Indicates whether the matrix is in row- or column-major order.

Input

Uplo

Enumeration type CBLAS_UPLO

Indicates whether matrix A is an upper triangular matrix or a lower triangular matrix.

  • If Uplo=CblasUpper, A is an upper triangular matrix.
  • If Uplo=CblasLower, A is the lower triangular matrix.

Input

TransA

Enumeration type CBLAS_TRANSPOSE

The matrix A is a conventional matrix, a transposed matrix, or a conjugate matrix.

  • If trans=CblasNoTrans, then .
  • If trans=CblasTrans, then .
  • If trans=CblasConjTrans, then .

Input

Diag

Enumeration type CBLAS_DIAG

Indicates whether A is a unit trigonometric array.

  • If Diag=CblasUnit, A is a unit triangular matrix.
  • If Diag=CblasNonUnit, A is not a unit triangular matrix.

Input

N

Integer

Order of matrix A. The value of N must be greater than or equal to 0.

Input

K

Integer

Super diagonal order of the matrix A, and K is required to be greater than or equal to zero.

Input

A

  • For stbsv, A is of single-precision floating-point type.
  • For dtbsv, A is of double-precision floating-point type.
  • For ctbsv, A is of single-precision complex number type.
  • For ztbsv, A is of double-precision complex number type.

Triangular band matrix A(lda, n)

Input

lda

Integer

Address distance stored in each column of matrix A. The value of lda must be greater than or equal to (k + 1).

Input

X

  • For stbsv, X is of single-precision floating-point type.
  • For dtbsv, X is of double-precision floating-point type.
  • For ctbsv, X is of single-precision complex number type.
  • For ztbsv, X is of double-precision complex number type.

Vector X. The vector scale is at least (1+(N-1)*abs(incX)).

Input/Output

incX

Integer

Vector increase step in X. The value cannot be 0.

Input

Dependencies

#include "kblas.h"

Examples

C interface:

    int n = 7, k = 3, lda = 5, incx = 1; 
    /** 
     *        |  .    .    .   2.0  2.0  3.0 1.0 | 
     *        |  .    .   2.0  1.0  2.0  4.0 0.0 | 
     *        |  .   2.0  2.0  3.0  4.0  2.0 1.0 | 
     *  A  =  | 1.0  3.0  3.0  3.0  3.0  3.0 3.0 | 
     *        |  .    .    .    .    .    .   .  | 
     */ 
    float a[35] = {0, 0, 0, 1.0, 0, 
                   0, 0, 2.0, 3.0, 0, 
                   0, 2.0, 2.0, 3.0, 0, 
                   2.0, 1.0, 3.0, 3.0, 0, 
                   2.0, 2.0, 4.0, 3.0, 0, 
                   3.0, 4.0, 2.0, 3.0, 0, 
                   1.0, 0.0, 1.0, 3.0, 0}; 
    float x[7] = {12.0, 12.0, 20.0, 26.0, 9.0, 13.0, 12.0}; 
 
    cblas_stbsv(CblasColMajor, CblasUpper, CblasNoTrans, CblasNonUnit, n, k, a, lda, x, incx); 
    /** 
     * Output x = |2.000000 2.000000 1.000000 2.000000 1.000000 3.000000 4.000000| 
     */

Fortran interface:

      PROGRAM TBMV 
      INTEGER :: N=7, K=3 
      INTEGER :: LDA=5, INCX=1 
      REAL(4) :: A(35), X(7) 
      DATA A/0, 0, 0, 1.0, 0, 
     $       0, 0, 2.0, 3.0, 0, 
     $       0, 2.0, 2.0, 3.0, 0, 
     $       2.0, 1.0, 3.0, 3.0, 0, 
     $       2.0, 2.0, 4.0, 3.0, 0, 
     $       3.0, 4.0, 2.0, 3.0, 0, 
     $       1.0, 0.0, 1.0, 3.0, 0/ 
      DATA X/12.0, 12.0, 20.0, 26.0, 9.0, 13.0, 12.0/ 
      EXTERNAL STBMV 
      CALL STBSV('U', 'N', 'N', N, K, A, LDA, X, INCX) 
      WRITE(*,*) X 
      END 
 
*     Output X = |2.00000000, 2.0000000, 1.00000000, 2.00000000, 1.00000000, 3.00000000, 4.00000000|