?ptts2
Solve the tridiagonal equation AX=B, where the coefficient matrix A is the ?pttrf factorization result.
Interface Definition
C interface:
void sptts2_(const int *N, const int *NRHS, float *D, float *E, float *B, const int *LDB);
void dptts2_(const int *N, const int *NRHS, double *D, double *E, double *B, const int *LDB);
void cptts2_(const int *IUPLO, const int *N, const int *NRHS, float *D, float _Complex *E, float _Complex *B, const int *LDB);
void zptts2_(const int *IUPLO, const int *N, const int *NRHS, double *D, double _Complex *E, double _Complex *B, const int *LDB);
Fortran interface:
SPTTS2(N, NRHS, D, E, B, LDB);
DPTTS2(N, NRHS, D, E, B, LDB);
CPTTS2(IUPLO, N, NRHS, D, E, B, LDB);
ZPTTS2(IUPLO, N, NRHS, D, E, B, LDB);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
IUPLO (specific to complex numbers) |
Integer |
|
Input |
N |
Integer |
Number of dimensions of matrix A, N ≥ 0 |
Input |
NRHS |
Integer |
Number of columns in matrix B, NRHS ≥ 0 |
Input |
D |
|
Diagonal element of tridiagonal matrix A, with a dimension of N. |
Input |
E |
|
Sub-diagonal element of tridiagonal matrix A, with a dimension of N-1. |
Input |
B |
|
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 |
Main dimension of matrix B. |
Input |
Dependencies
#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};
dptts2_(&n, &nrhs, d, e, b, &ldb);
/*
* Output:
* b: 0.039697 -0.000760 0.161909 -0.080924
*/
Fortran interface:
PARAMETER (n = 4) PARAMETER (ldb = 4) PARAMETER (nrhs = 1) 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 DPTTS2 CALL DPTTS2(n, nrhs, d, e, b, ldb); * * Output: * b: 0.039697 -0.000760 0.161909 -0.080924