?ptsv
Solve a system of linear equations, in which the coefficient matrix A is a real (conjugate) symmetric positive definite tridiagonal matrix.
Interface Definition
C interface:
void sptsv_(const int *N, const int *NRHS, float *D, float *E, float *B, const int *LDB, int *INFO);
void dptsv_(const int *N, const int *NRHS, double *D, double *E, double *B, const int *LDB, int *INFO);
void cptsv_(const int *N, const int *NRHS, float *D, float _Complex *E, float _Complex *B, const int *LDB, int *INFO);
void zptsv_(const int *N, const int *NRHS, double *D, double _Complex *E, double _Complex *B, const int *LDB, int *INFO);
Fortran interface:
SPTSV(N, NRHS, D, E, B, LDB, INFO);
DPTSV(N, NRHS, D, E, B, LDB, INFO);
CPTSV(N, NRHS, D, E, B, LDB, INFO);
ZPTSV(N, NRHS, D, E, B, LDB, INFO);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
N |
Integer |
Number of dimensions of matrix A, N ≥ 0 |
Input |
NRHS |
Integer |
Number of columns in matrix B, NRHS ≥ 0 |
Input |
D |
|
When as an input value, it is a diagonal element of tridiagonal matrix A, and its dimension is N. When as an output value, it is a diagonal element D after factorization. |
Input/Output |
E |
|
When as an input value, it is a sub-diagonal element of tridiagonal matrix A, and its dimension is N-1. When as an output value, it is a sub-diagonal element of matrix A after factorization. |
Input/Output |
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 |
Leading dimension of matrix B |
Input |
INFO |
Integer |
|
Output |
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};
int info = 0;
dptsv_(&n, &nrhs, d, e, b, &ldb, &info);
/*
* Output:
* d: 7.608696 7.722759 7.347826 4.559874
* e: 0.046387 0.000000 0.112078
* b: 0.038912 0.011147 0.092279 0.026655
*/
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 DPTSV CALL DPTSV(n, nrhs, d, e, b, ldb, info); * * Output: * d: 7.608696 7.722759 7.347826 4.559874 * e: 0.046387 0.000000 0.112078 * b: 0.038912 0.011147 0.092279 0.026655