# Solving a Positive Definite System of Linear Equations (sv)

sv computes the solution to a real (or complex) system of linear equations $$A X = B$$, where $$A$$ is a $$n \times n$$ symmetric (or hermitian) positive definite matrix and $$X$$ and $$B$$ are $$n \times n_{\text{rhs}}$$ matrices.

## Real Variant

The Cholesky decomposition is used to factor $$A$$ as

• $$A = U^T U$$, if $$A$$ is stored in the upper triangular part,

• $$A = L L^T$$, if $$A$$ is stored in the lower triangular part,

where $$U$$ is an upper triangular matrix and $$L$$ is a lower triangular matrix. The factored form of $$A$$ is then used to solve the system of equations $$A X = B$$.

 A (input/output) real valued SyMatrix On entry, the symmetric matrix $$A$$ stored either in the upper or lower triangular part of $$A$$. The other part is not referenced. On exit, if the return value is zero, the factor $$U$$ or $$L$$ from the Cholesky factorization $$A = U^T U$$ or $$A = L L^T$$. B (input/output) real valued GeMatrix On entry, the $$n \times n_{\text{rhs}}$$ right hand side matrix $$B$$.+ On exit, if the return value equals zero, the $$n \times n_{\text{rhs}}$$ solution matrix $$X$$.

Return value:

 i=0 Successful exit. i>0 The leading minor of order $$i$$ is not positive definite, and the factorization could not be completed, and the solution has not been computed.

## Complex Variant

The Cholesky decomposition is used to factor $$A$$ as

• $$A = U^H U$$, if $$A$$ is stored in the upper triangular part,

• $$A = L L^H$$, if $$A$$ is stored in the lower triangular part,

where $$U$$ is an upper triangular matrix and $$L$$ is a lower triangular matrix. The factored form of $$A$$ is then used to solve the system of equations $$A X = B$$.

 A (input/output) complex valued HeMatrix On entry, the hermitian matrix $$A$$ stored either in the upper or lower triangular part of $$A$$. The other part is not referenced. On exit, if the return value is zero, the factor $$U$$ or $$L$$ from the Cholesky factorization $$A = U^T U$$ or $$A = L L^T$$. B (input/output) complex valued GeMatrix On entry, the $$n \times n_{\text{rhs}}$$ right hand side matrix $$B$$.+ On exit, if the return value equals zero, the $$n \times n_{\text{rhs}}$$ solution matrix $$X$$.

Return value:

 i=0 Successful exit. i>0 The leading minor of order $$i$$ is not positive definite, and the factorization could not be completed, and the solution has not been computed.

## Single Right-Hand Side (Real and Complex Variant)

 A (input/output) real valued SyMatrix or complex valued HeMatrix On entry, the symmetric or hermitian matrix $$A$$ stored either in the upper or lower triangular part of $$A$$. The other part is not referenced. On exit, if the return value is zero, the factor $$U$$ or $$L$$ from the Cholesky factorization $$A = U^H U$$ or $$A = L L^H$$. b (input/output) real or complex valued DenseVector On entry, the right hand side vector $$b$$.+ On exit, if the return value equals zero, the solution vector $$x$$.

Return value:

 i=0 Successful exit. i>0 The leading minor of order $$i$$ is not positive definite, and the factorization could not be completed, and the solution has not been computed.