Rate This Document
Findability
Accuracy
Completeness
Readability

?ppsv

Solve the system of linear equations , where A is a positive definite matrix of real symmetry or conjugate symmetry and is stored in a packed manner, and X and B are matrices. Compute the Cholesky factorization of matrix A, and solve the system of linear equations based on the factorization result.

Interface Definition

C interface:

void dppsv_(const char *uplo, const int *n, const int *nrhs, double *ap, double *b, const int *ldb, int *info);

void sppsv_(const char *uplo, const int *n, const int *nrhs, float *ap, float *b, const int *ldb, int *info);

void cppsv_(const char *uplo, const int *n, const int *nrhs, float _Complex *ap, float _Complex *b, const int *ldb, int *info);

void zppsv_(const char *uplo, const int *n, const int *nrhs, double _Complex *ap, double _Complex *b, const int *ldb, int *info);

Fortran interface:

DPPSV(uplo, n, nrhs, ap, b, ldb, info);

SPPSV(uplo, n, nrhs, ap, b, ldb, info);

CPPSV(uplo, n, nrhs, ap, b, ldb, info);

ZPPSV(uplo, n, nrhs, ap, b, ldb, info);

Parameters

Parameter

Type

Description

Input/Output

uplo

String

  • 'U': saves the upper triangular matrix of A.
  • 'L': saves the lower triangular matrix of A.

Input

n

Integer

Number of rows or columns in the symmetric matrix A.

Input

nrhs

Integer

Number of items on the right, that is, the number of columns in matrix B. nrhs ≥ 0.

Input

ap

  • A single-precision floating-point array in sppsv
  • A double-precision floating-point array in dppsv
  • A single-precision complex number array in cppsv
  • A double-precision complex number array in zppsv
  • Before calling, symmetric matrix A is stored in the packed format. For details, see the description of the packed storage matrix in the Data Structures.
  • After calling, the Cholesky factorization result (U or L) of matrix A is stored in the packed format.

Input/Output

b

  • A single-precision floating-point array in sppsv
  • A double-precision floating-point array in dppsv
  • A single-precision complex number array in cppsv
  • A double-precision complex number array in zppsv
  • Matrix B on the right before calling.
  • Solved matrix X after calling.

Input/Output

ldb

Integer

Leading dimension of matrix B. ldb ≥ max(1, n).

Input

info

Integer

Execution result:

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

Output

Dependencies

#include "klapack.h"

Examples

C interface:

    char uplo = 'L'; 
    int n = 5; 
    int nrhs = 2; 
    int ldb = 5; 
    int info = 0; 
    /* 
     * A (stored in column-major): 
     *  178.535    33.2929    9.2538   11.1156   21.5482 
     *   33.2929  156.5955    5.1031   55.771    41.3063 
     *    9.2538    5.1031  100.5198   73.8396   23.04 
     *   11.1156   55.771    73.8396  106.5638   56.19 
     *   21.5482   41.3063   23.04     56.19    114.5161 
     */ 
    double ap[] = {178.535,  33.2929,  9.2538, 11.1156, 21.5482, 
                            156.5955,  5.1031, 55.771,  41.3063, 
                                     100.5198, 73.8396, 23.04, 
                                              106.5638, 56.19, 
                                                       114.5161}; 
    double b[] = {0.374, 6.242, 5.593, 2.456, 5.222, 
                    6.906, 2.31 , 3.948, 6.403, 5.664}; 
 
    dppsv_(&uplo, &n, &nrhs, ap, b, &ldb, &info); 
    /* 
     * Output X: 
     *  -0.0186   0.0373 
     *   0.0770  -0.0235 
     *   0.1536  -0.0208 
     *  -0.1574   0.0726 
     *   0.0677   0.0195 
     */

Fortran interface:

        CHARACTER :: uplo = "L" 
        PARAMETER (n = 5) 
        PARAMETER (nrhs = 2) 
        PARAMETER (ldb = 5) 
        INTEGER :: info = 0 
 
*       A (stored in column-major): 
*        178.535    33.2929    9.2538   11.1156   21.5482 
*         33.2929  156.5955    5.1031   55.771    41.3063 
*          9.2538    5.1031  100.5198   73.8396   23.04 
*         11.1156   55.771    73.8396  106.5638   56.19 
*         21.5482   41.3063   23.04     56.19    114.5161 
 
        REAL(8) :: ap(15) 
        DATA ap / 178.535,  33.2929,  9.2538, 11.1156, 21.5482, 
     $                      156.5955, 5.1031, 55.771,  41.3063, 
     $                                100.5198, 73.8396, 23.04, 
     $                                          106.5638, 56.19, 
     $                                                    114.5161 / 
        REAL(8) :: b(n, nrhs) 
        DATA b / 0.374, 6.242, 5.593, 2.456, 5.222, 
     $           6.906, 2.31 , 3.948, 6.403, 5.664 / 
 
        EXTERNAL DPPSV 
        CALL DPPSV(uplo, n, nrhs, ap, b, ldb, info); 
*       Output X: 
*        -0.0186   0.0373 
*         0.0770  -0.0235 
*         0.1536  -0.0208 
*        -0.1574   0.0726 
*         0.0677   0.0195