我要评分
获取效率
正确性
完整性
易理解

?pptrf

Compute the LLT or UTU factorization of a symmetric positive definite matrix in packed storage.

Interface Definition

C interface:

void spptrf_(const char *uplo, const int *n, float *ap, int *info);

void dpptrf_(const char *uplo, const int *n, double *ap, int *info);

void cpptrf_(const char *uplo, const int *n, float _Complex *ap, int *info);

void zpptrf_(const char *uplo, const int *n, double _Complex *ap, int *info);

Fortran interface:

SPPTRF(UPLO, N, AP, INFO);

DPPTRF(UPLO, N, AP, INFO);

CPPTRF(UPLO, N, AP, INFO);

ZPPTRF(UPLO, N, AP, 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 in matrix A, N ≥ 0.

Input

AP

  • A single-precision floating-point array for spptrf
  • A double-precision floating-point array for dpptrf
  • A single-precision complex array for cpptrf
  • A double-precision complex array for zpptrf
  • When input, it is the upper/lower triangular part of matrix A and has a size of N*(N+1)/2.
  • When output, it is the triangular factor U or L, and is stored as an upper or lower triangular matrix overwriting A.

Input, output

INFO

Integer

  • 0: The exit is successful.
  • Smaller than 0: The value of the -info-th parameter is invalid.
  • Greater than 0: The sequence principal minor is not positive definite, and the factorization cannot be completed.

Output

Dependency

#include "klapack.h"

Examples

C interface:

const char uplo = 'U';
const int n = 4;
double ap[] = {231.8009,33.9545,162.2902,9.4143,6.6684,100.322,11.1156,53.2033,71.5384,106.5638};
int info = 0;
dpptrf_(&uplo, &n, ap, &info);
if (info != 0) {
    printf("ERROR, info = %d\n", info);
}

/* 
* Output: 
*   ap: 15.225009    2.230179    12.542587    0.618344    0.421714    9.988083    0.730088    4.111996    6.943561    6.396031
*/

Fortran interface:

CHARACTER::uplo = "U"
PARAMETER (n = 4)  
INTEGER :: info = 0 
REAL(8) :: ap(n*(n+1)/2) 
  
DATA ap / 231.8009,33.9545,162.2902,9.4143,6.6684,100.322,11.1156,53.2033,71.5384,106.5638 / 

 EXTERNAL DPPTRF 
 CALL DPPTRF(uplo, n, ap, info);
* 
* Output: 
*   ap: 15.225009    2.230179    12.542587    0.618344    0.421714    9.988083    0.730088    4.111996    6.943561    6.396031