?potri
计算对称正定矩阵的逆。
接口定义
C interface:
void spotri_(const char *UPLO, const int *N, const float *A, const int *LDA, int *INFO);
void dpotri_(const char *UPLO, const int *N, const double *A, const int *LDA, int *INFO);
void cpotri_(const char *UPLO, const int *N, const float _Complex *A, const int *LDA, int *INFO);
void zpotri_(const char *UPLO, const int *N, const double _Complex *A, const int *LDA, int *INFO);
Fortran Interface:
SPOTRI(UPLO, N, A, LDA, INFO);
DPOTRI(UPLO, N, A, LDA, INFO);
CPOTRI(UPLO, N, A, LDA, INFO);
ZPOTRI(UPLO, N, A, LDA, INFO);
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
UPLO |
字符型 |
'U':保存A的上三角矩阵。 'L':保存A的下三角矩阵。 |
输入 |
N |
整数型 |
矩阵A的维数,n ≥ 0。 |
输入 |
A |
|
|
输入、输出 |
LDA |
整数型 |
A的leading dimension大小,lda ≥ max(1,n)。 |
输入 |
INFO |
整数型 |
执行结果:
|
输出 |
依赖
#include "klapack.h"
示例
C Interface:
char uplo = 'L' int n = 4; int lda = n; int info = 0; /* * A: After Cholesky factorization (via potrf, stored in column-major): * 231.8009 33.9545 9.4153 11.1156 * 33.9454 162.2902 6.6684 53.2023 * 9.4153 6.6684 100.3220 71.5384 * 11.1156 53.2023 71.5384 123.4425 */ double a[] = {231.8009, 33.9545, 9.4143, 11.1156, 33.9495, 162.2902, 6.6684, 53.2033, 9.4143, 6.6684, 100.322, 71.5384, 11.1156, 53.2033, 71.5384, 106.5638 }; dpotri_(&uplo, &n, a, &lda, &info); /* * Output: * 0.000020 -0.000006 -0.000005 0.000002 * 33.949500 0.000046 0.000015 -0.000026 * 9.414300 6.668400 0.000144 -0.000063 * 11.115600 53.203300 71.538400 0.000088 */
Fortran Interface:
CHARACTER :: uplo = "L" PARAMETER (n = 4) PARAMETER (lda = 4) INTEGER :: info = 0 REAL(8) :: a(n,n) * A: After Cholesky factorization (via potrf, stored in column-major): * 231.8009 33.9545 9.4153 11.1156 * 33.9454 162.2902 6.6684 53.2023 * 9.4153 6.6684 100.3220 71.5384 * 11.1156 53.2023 71.5384 123.4425 DATA a / 231.8009, 33.9545, 9.4143, 11.1156, $ 33.9495, 162.2902, 6.6684, 53.2033, $ 9.4143, 6.6684, 100.322, 71.5384, $ 11.1156, 53.2033, 71.5384, 106.5638 / EXTERNAL DPOTRF CALL DPOTRI (uplo, n, a, lda, info); * * Output: * 0.000020 -0.000006 -0.000005 0.000002 * 33.949500 0.000046 0.000015 -0.000026 * 9.414300 6.668400 0.000144 -0.000063 * 11.115600 53.203300 71.538400 0.000088 *
父主题: 矩阵求逆函数