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

?trsv

Solve linear equations. The coefficient matrix is a triangular matrix.

, or .

x and b are vectors including n elements, and A is a triangular matrix of an n*n unit or a non-unit.

Interface Definition

C interface:

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

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

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

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

Fortran interface:

CALL STRSV(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)

CALL DTRSV(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)

CALL CTRSV(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)

CALL ZTRSV(UPLO, TRANS, DIAG, N, 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 to use the upper triangle or lower triangle of matrix A.

  • If Uplo = CblasUpper, the upper triangle of A is used.
  • If Uplo = CblasLower, the lower triangle of A is used.

Input

TransA

Enumeration type CBLAS_TRANSPOSE

Indicates whether the matrix A is a conventional matrix, a transpose 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 matrix.

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

Input

N

Integer

Order of the matrix A. N must be greater than or equal to zero.

Input

A

  • For strsv, A is of single-precision floating-point type.
  • For dtrsv, A is of double-precision floating-point type.
  • For ctrsv, A is of single-precision complex number type.
  • For ztrsv, A is of double-precision complex number type.

Triangular matrix. The minimum matrix size is lda*N.

Input

lda

Integer

Leading dimension of matrix A. The value of lda must be greater than or equal to max(1, N).

Input

X

  • For strsv, X is of single-precision floating-point type.
  • For dtrsv, X is of double-precision floating-point type.
  • For ctrsv, X is of single-precision complex number type.
  • For ztrsv, 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

Increment for elements in X. The value cannot be 0.

Input

Dependencies

#include "kblas.h"

Examples

C interface:

    int  n = 4, lda = 4,incx = 1; 
    float x[4] = {4.0, 3.0, 2.0, 1.0}; 
    /** 
     *        |  1.0 1.0  1.0  3.0 | 
     * A   =  |  .   3.0  3.0  2.0 | 
     *        |  .    .   2.0  3.0 | 
     *        |  .    .    .   1.0 | 
     */ 
    float ap[16] = {1.0, 0, 0, 0, 1.0, 3.0, 0, 0, 1.0, 3.0, 2.0, 0, 3.0, 2.0, 3.0, 1.0}; 
 
    cblas_strsv(CblasColMajor, CblasUpper, CblasTrans, CblasNonUnit, n, ap, lda, x, incx); 
    /** 
     * Output x = |4.000000, -0.333333, -0.500000, -8.833333| 
     */

Fortran interface:

      INTEGER :: N=4, INCX=1 
      INTEGER :: LDA=4 
      REAL(4) :: X(4), AP(16) 
      DATA X/4.0, 3.0, 2.0, 1.0/ 
      DATA AP/1.0, 0, 0, 0, 1.0, 3.0, 0, 0, 1.0, 3.0, 2.0, 0, 3.0, 
     $        2.0, 3.0, 1.0/ 
      EXTERNAL STRSV 
      CALL STRSV('U', 'T', 'N', N, A, LDA, X, INCX) 
 
*     Output X = |4.000000, -0.333333, -0.500000, -8.833333|