?gttrf
Compute the LU factorization of general tridiagonal matrix A.
Interface Definition
C interface:
void sgttrf(const int *N, float *DL, float *D, float *DU, float *DU2, int *IPIV, int *INFO);
void dgttrf(const int *N, double *DL, double *D, double *DU, double *DU2, int *IPIV, int *INFO);
void cgttrf(const int *N, float _Complex *DL, float _Complex *D, float _Complex *DU, float _Complex *DU2, int *IPIV, int *INFO);
void zgttrf(const int *N, double _Complex *DL, double _Complex *D, double _Complex *DU, double _Complex *DU2, int *IPIV, int *INFO);
Fortran interface:
SGTTRF(N,DL,D,DU,DU2,IPIV,INFO);
DGTTRF(N,DL,D,DU,DU2,IPIV,INFO);
CGTTRF(N,DL,D,DU,DU2,IPIV,INFO);
ZGTTRF(N,DL,D,DU,DU2,IPIV,INFO);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
N |
Integer |
Number of dimensions in matrix A, N ≥ 0. |
Input |
DL |
|
As an input value, it represents a sub-diagonal element of tridiagonal matrix A, with a dimension of N-1. As an output value, it represents matrix L. |
Input, output |
D |
|
As an input value, it represents a diagonal element of tridiagonal matrix A, with a dimension of N. As an output value, it represents a diagonal element of matrix U. |
Input, output |
DU |
|
As an input value, it represents a super-diagonal element of tridiagonal matrix A, with a dimension of N-1. As an output value, it represents the first super-diagonal element of U. |
Input, output |
DU2 |
|
As an output value, it represents the second super-diagonal element of U. |
Output |
IPIV |
Integer |
Permutation array. |
Output |
INFO |
Integer |
|
Output |
Dependency
#include "klapack.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | const int n = 4; double dl[] = {0.923077, 0.153846, 0.153846}; double d[] = {0.521739, 0.043478, 0.304348, 0.086957}; double du[] = {0.924528, 0.150943, 0.566038}; double du2[] = {0.986301, 0.397260}; double ipiv[4]; int info = 0; dgttrf_(&n, dl, d, du, du2, ipiv, &info); if (info != 0) { printf("ERROR, info = %d\n", info); } /* * Output: * d: 0.923077 0.899954 0.318932 -0.186088 * dl: 0.565217 0.170949 0.482378 * du: 0.043478 -0.085316 0.566038 * du2: 0.150943 0.000000 * ipiv: 2 2 3 4 */ |
Fortran interface:
PARAMETER (n = 4) INTEGER :: info = 0 REAL(8) :: d(n) REAL(8) :: dl(n-1) REAL(8) :: du(n-1) REAL(8) :: du2(n-2) INTEGER :: ipiv(n) DATA d / 0.521739, 0.043478, 0.304348, 0.086957 / DATA dl / 0.923077, 0.153846, 0.153846 / DATA du / 0.924528, 0.150943, 0.566038 / DATA du2 / 0.986301, 0.397260 / EXTERNAL DGTTRF CALL DGTTRF(n, dl, d, du, du2, ipiv, info); * * Output: * d: 0.923077 0.899954 0.318932 -0.186088 * dl: 0.565217 0.170949 0.482378 * du: 0.043478 -0.085316 0.566038 * du2: 0.150943 0.000000 * ipiv: 2 2 3 4