Rate This Document
Findability
Accuracy
Completeness
Readability

?gtts2

Solve the tridiagonal equation A * X = B, AT * X = B, or AH * X = B, where coefficient matrix A is the ?gttrf factorization result.

Interface Definition

C interface:

sgtts2_(const int *trans, const int *n, const int *nrhs, const float *dl, const float *d, const float *du, const float *du2, const int *ipiv, float *b, const int *ldb);

dgtts2_(const int *trans, const int *n, const int *nrhs, const double *dl, const double *d, const double *du, const double *du2, const int *ipiv, double *b, const int *ldb);

cgtts2_(const int *trans, const int *n, const int *nrhs, const float _Complex *dl, const float _Complex *d, const float _Complex *du, const float _Complex *du2, const int *ipiv, float _Complex *b, const int *ldb);

zgtts2_(const int *trans, const int *n, const int *nrhs, const double _Complex *dl, const double _Complex *d, const double _Complex *du, const double _Complex *du2, const int *ipiv,double _Complex *b, const int *ldb);

Fortran interface:

SGTTS2(TRANS, N, NRHS, DL, D, DU, DU2, IPIV, B, LDB);

DGTTS2(TRANS, N, NRHS, DL, D, DU, DU2, IPIV, B, LDB);

CGTTS2(TRANS, N, NRHS, DL, D, DU, DU2, IPIV, B, LDB);

ZGTTS2(TRANS, N, NRHS, DL, D, DU, DU2, IPIV, B, LDB);

Parameters

Parameter

Type

Description

Input/Output

TRANS

Character

  • If the value is 'N', A * X = B.
  • If the value is 'T', AT * X = B.
  • If the value is 'C', AT * X = B (conjugate transposition).

Input

N

Integer

Order of matrix A, N ≥ 0.

Input

NRHS

Integer

Number of columns in matrix B, NRHS ≥ 0.

Input

DL

  • A single-precision floating-point array for sgtts2
  • A double-precision floating-point array for dgtts2
  • A single-precision complex array for cgtts2
  • A double-precision complex array for zgtts2

Matrix L from the LU factorization, with a dimension of N–1.

Input

D

  • A single-precision floating-point array for sgtts2
  • A double-precision floating-point array for dgtts2
  • A single-precision complex array for cgtts2
  • A double-precision complex array for zgtts2

Diagonal element of U, with a dimension of N.

Input

DU

  • A single-precision floating-point array for sgtts2
  • A double-precision floating-point array for dgtts2
  • A single-precision complex array for cgtts2
  • A double-precision complex array for zgtts2

First super-diagonal element of U.

Input

DU2

  • A single-precision floating-point array for sgtts2
  • A double-precision floating-point array for dgtts2
  • A single-precision complex array for cgtts2
  • A double-precision complex array for zgtts2

Second super-diagonal element of U.

Input

IPIV

Integer array

Transposed array.

Input

B

  • A single-precision floating-point array for sgtts2
  • A double-precision floating-point array for dgtts2
  • A single-precision complex array for cgtts2
  • A double-precision complex array for zgtts2

Right-hand side matrix, with a dimension of (LDB, NRHS).

Input/Output

LDB

Integer

Leading dimension of matrix B.

Input

Dependency

include "klapack.h"

Examples

C interface:

const char trans = 'N';
const int n = 4;
const int ldb = n;
const int nrhs = 1;
double dl[] = {0.565217, 0.170949, 0.482378};
double d[] = {0.923077, 0.899954, 0.318932, -0.186088};
double du[] = {0.043478, -0.085316, 0.566038};
double du2[] = {0.150943, 0.000000};
double b[] = {0.301370, 0.835616, 0.109589, 0.041096};
int ipiv[] = {2,2,3,4};

dgtts2_(&trans, &n, &nrhs, dl, d, du, du2, ipiv, b, &ldb);

/* 
* Output: 
*   b:  0.882521        -0.172061       0.188567        0.138984
*/

Fortran interface:

CHARACTER :: trans = "N"
PARAMETER (n = 4) 
PARAMETER (ldb = 4)
PARAMETER (nrhs = 1) 
REAL(8) :: d(n) 
REAL(8) :: dl(n-1)
REAL(8) :: du(n-1)
REAL(8) :: du2(n-2)
REAL(8) :: b(ldb, nrhs)  
INTEGER :: ipiv(n)
  
DATA d / 0.923077, 0.899954, 0.318932, -0.186088 / 
DATA dl / 0.565217, 0.170949, 0.482378/
DATA du / 0.043478, -0.085316, 0.566038 /
DATA du2 / 0.150943, 0.000000 /
DATA b / 0.301370, 0.835616, 0.109589, 0.041096 /
DATA ipiv / 2,2,3,4 /
 EXTERNAL DGTTS2 
 CALL DGTTS2(trans, n, nrhs, dl, d, du, du2, ipiv, b, ldb);
* 
* Output: 
*   d:  0.882521        -0.172061       0.188567        0.138984