Rate This Document
Findability
Accuracy
Completeness
Readability

?pttrs

Solve the tridiagonal equation AX = B, where the coefficient matrix A is the ?pttrf factorization result.

Interface Definition

C interface:

void spttrs_(const int *N, const int *NRHS, float *D, float *E, float *B, const int *LDB, int *INFO);

void dpttrs_(const int *N, const int *NRHS, double *D, double *E, double *B, const int *LDB, int *INFO);

void cpttrs_(const char *UPLO, const int *N, const int *NRHS, float *D, float _Complex *E, float _Complex *B, const int *LDB, int *INFO);

void zpttrs_(const char *UPLO, const int *N, const int *NRHS, double *D, double _Complex *E, double _Complex *B, const int *LDB, int *INFO);

Fortran interface:

SPTTRS(N, NRHS, D, E, B, LDB, INFO);

DPTTRS(N, NRHS, D, E, B, LDB, INFO);

CPTTRS(UPLO, N, NRHS, D, E, B, LDB, INFO);

ZPTTRS(UPLO, N, NRHS, D, E, B, LDB, INFO);

Parameters

Parameter

Type

Description

Input/Output

UPLO (specific to complex numbers)

Character

  • 'U': A=U**H*D*U
  • 'L': A=L*D*L**H

Input

N

Integer

Number of dimensions of matrix A, N ≥ 0.

Input

NRHS

Integer

Number of columns in matrix B, NRHS ≥ 0.

Input

D

  • A single-precision floating-point array for spttrs/cpttrs
  • A double-precision floating-point array for dpttrs/zpttrs

Diagonal element of tridiagonal matrix A, with a dimension of N.

Input

E

  • A single-precision floating-point array for spttrs
  • A double-precision floating-point array for dpttrs
  • A single-precision complex array for cpttrs
  • A double-precision complex array for zpttrs

Sub-diagonal element of tridiagonal matrix A, with a dimension of N-1.

Input

B

  • For spttrs, B is a single-precision floating-point array.
  • For dpttrs, B is a double-precision floating-point array.
  • A single-precision complex array for cpttrs
  • A double-precision complex array for zpttrs

When as an input value, it is a right-hand side matrix, and the dimension is (LDB, NRHS).

When as an output value, it is the result X, and the dimension is (LDB, NRHS).

Input, output

LDB

Integer

Leading dimension of matrix B.

Input

INFO

Integer

  • 0: The exit is successful.
  • Smaller than 0: The value of the -info-th parameter is invalid.

Output

Dependency

#include "klapack.h"

Examples

C interface:

    const int n = 4;
    const int ldb = n;
    const int nrhs = 1;
    double d[] = {7.608696,7.739130, 7.347826,4.652174};
    double e[] = {0.352941,0.000000,0.823529};
    double b[] = {0.300000,0.100000,0.700000,0.200000};
    int info = 0;
    
    dpttrs_(&n, &nrhs, d, e, b, &ldb, &info);
/* 
* Output: 
*   b: 0.039697        -0.000760       0.161909        -0.080924
*/

Fortran interface:

PARAMETER (n = 4) 
PARAMETER (ldb = 4)
PARAMETER (nrhs = 1) 
INTEGER :: info = 0 
REAL(8) :: d(n) 
REAL(8) :: e(n-1)
REAL(8) :: b(ldb, nrhs)  
  
DATA d / 7.608696,7.739130, 7.347826,4.652174 / 
DATA e / 0.352941,0.000000,0.823529 /
DATA b / 0.300000,0.100000,0.700000,0.200000 /
 EXTERNAL DPTTRS 
 CALL DPTTRS(n, nrhs, d, e, b, ldb, info);
* 
* Output: 
*  b: 0.039697        -0.000760       0.161909        -0.080924