?hptrf
计算压缩Hermite矩阵的LDL*或U*DU分解。
接口定义
C Interface:
void chptrf_(const char *uplo, const int *n, float _Complex *ap, int *ipiv, int *info);
void zhptrf_(const char *uplo, const int *n, double _Complex *ap, int *ipiv, int *info);
Fortran Interface:
CHPTRF(UPLO, N, AP, IPIV, INFO);
ZHPTRF(UPLO, N, AP, IPIV, INFO);
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
UPLO |
字符数 |
|
输入 |
N |
整数型 |
矩阵A的维数,N≥0。 |
输入 |
AP |
|
|
输入、输出 |
IPIV |
整数型 |
转置数组,大小为N,表示对角矩阵D的块结构和交换细节。
|
输出 |
INFO |
整数型 |
|
输出 |
依赖
#include "klapack.h"
示例
C Interface:
const char uplo = 'U'; const int n = 4; double ap[] = {0.521739, 0.043478, 0.304348, 0.130435, 0.304348, 0.043478, 0.652174, 0.086957, 0.521739, 0.086957}; double ipiv[4]; int info = 0; zhptrf_(&uplo, &n, ap, ipiv, &info); if (info != 0) { printf("ERROR, info = %d\n", info); } /* * Output: * ap: -0.129534 1.024339 0.302185 -0.492537 -0.044777 -0.728261 1.250000 0.083333 0.250000 0.521739 * ipiv: 1 2 1 1 */
Fortran Interface:
CHARACTER::uplo = "U" PARAMETER (n = 4) INTEGER :: info = 0 REAL(8) :: ap(n*(n+1)/2) INTEGER :: ipiv(n) DATA ap / 0.521739, 0.043478, 0.304348, 0.130435, 0.304348, 0.043478, 0.652174, 0.086957, 0.521739, 0.086957 / EXTERNAL ZHPTRF CALL ZHPTRF(uplo, n, ap, ipiv, info); * * Output: * ap: -0.129534 1.024339 0.302185 -0.492537 -0.044777 -0.728261 1.250000 0.083333 0.250000 0.521739 * ipiv: 1 2 1 1
父主题: 矩阵分解函数