?potri
Compute the inverse of a symmetric positive definite matrix.
Interface Definition
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);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
uplo |
Character |
'U': saves the upper triangular matrix of A. 'L': saves the lower triangular matrix of A. |
Input |
n |
Integer |
Number of dimensions of array a (n ≥ 0) |
Input |
a |
|
|
Input/Output |
lda |
Integer |
Leading dimension of the matrix A. lda ≥ max(1, n). |
Input |
info |
Integer |
Execution result:
|
Output |
Dependencies
#include "klapack.h"
Examples
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 *