P?POTRF
Calculate the Cholesky factorization of a symmetric positive definite matrix or a Hermitian positive definite matrix, that is,
or
.
is an upper triangular matrix, and
is a lower triangular matrix.
Interface Definition
C interface:
void pspotrf_(const char *uplo, const int *n, float *a, const int *ia, const int *ja, const int *desca, int *info)
void pdpotrf_(const char *uplo, const int *n, double *a, const int *ia, const int *ja, const int *desca, int *info)
void pcpotrf_(const char *uplo, const int *n, float _Complex *a, const int *ia, const int *ja, const int *desca, int *info)
void pzpotrf_(const char *uplo, const int *n, double _Complex *a, const int *ia, const int *ja, const int *desca, int *info)
Fortran interface:
PSPOTRF(uplo, n, a, ia, ja, desca, info)
PDPOTRF(uplo, n, a, ia, ja, desca, info)
PCPOTRF(uplo, n, a, ia, ja, desca, info)
PZPOTRF(uplo, n, a, ia, ja, desca, info)
Parameters
Parameter |
Type |
Scope |
Description |
Input/Output |
|---|---|---|---|---|
uplo |
Character |
Global |
U indicates the upper triangular matrix is stored, and L indicates the lower triangular matrix is stored. |
Input |
n |
Integer |
Global |
Number of columns to be operated, for example, the number of columns in a submatrix |
Input |
a |
|
Local |
|
Input/Output |
ia |
Integer |
Global |
Row indices of the submatrix in the global matrix |
Input |
ja |
Integer |
Global |
Column indices of the submatrix in the global matrix |
Input |
desca |
Integer array |
Local and global |
Descriptor of distributed matrix A |
Input |
info |
Integer |
Global |
Execution result:
|
Output |
Dependencies
#include <kscalapack.h>
Examples
int n = 8; // (Global) Matrix size
int nprow = 2; // Number of row procs
int npcol = 2; // Number of column procs
int nb = 4; // (Global) Block size
char uplo='L'; // Matrix is lower triangular
char layout='R'; // Block cyclic, Row major processor mapping
int descA[9];
int info;
int lddA = mpA > 1 ? mpA : 1;
descinit_( descA, &n, &n, &nb, &nb, &izero, &izero, &ictxt, &lddA, &info);
np = 4;
/*
* Origin A:
*
*16 1 2 3 4 5 6 7
*1 16 3 4 5 6 7 8
*2 3 16 5 6 7 8 9
*3 4 5 16 7 8 9 10
*4 5 6 7 16 9 10 11
*5 6 7 8 9 16 11 12
*6 7 8 9 10 11 16 13
*7 8 9 10 11 12 13 16
/* Query optimal work size */
pdpotrf_(&uplo, &n, A, &ione, &ione, descA, &info);
* After PDPOTRF:
*4.00000 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000
*0.250000 3.99218 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000
*0.500000 0.720158 3.90274 5.00000 6.00000 7.00000 8.00000 9.00000
*0.750000 0.954992 1.00884 3.67529 7.00000 8.00000 9.00000 10.0000
*1.00000 1.18983 1.18971 1.06481 3.32191 9.00000 10.0000 11.0000
*1.25000 1.42466 1.37058 1.17522 0.955149 2.86983 11.0000 12.0000
*1.50000 1.65949 1.55145 1.28562 0.996646 0.756689 2.31741 13.0000
*1.75000 1.89433 1.73232 1.39603 1.03814 0.734271 0.500013 1.59132