f07 Chapter Contents
f07 Chapter Introduction
NAG Library Manual

# NAG Library Function Documentnag_dpptri (f07gjc)

## 1  Purpose

nag_dpptri (f07gjc) computes the inverse of a real symmetric positive definite matrix $A$, where $A$ has been factorized by nag_dpptrf (f07gdc), using packed storage.

## 2  Specification

 #include #include
 void nag_dpptri (Nag_OrderType order, Nag_UploType uplo, Integer n, double ap[], NagError *fail)

## 3  Description

nag_dpptri (f07gjc) is used to compute the inverse of a real symmetric positive definite matrix $A$, the function must be preceded by a call to nag_dpptrf (f07gdc), which computes the Cholesky factorization of $A$, using packed storage.
If ${\mathbf{uplo}}=\mathrm{Nag_Upper}$, $A={U}^{\mathrm{T}}U$ and ${A}^{-1}$ is computed by first inverting $U$ and then forming $\left({U}^{-1}\right){U}^{-\mathrm{T}}$.
If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$, $A=L{L}^{\mathrm{T}}$ and ${A}^{-1}$ is computed by first inverting $L$ and then forming ${L}^{-\mathrm{T}}\left({L}^{-1}\right)$.

## 4  References

Du Croz J J and Higham N J (1992) Stability of methods for matrix inversion IMA J. Numer. Anal. 12 1–19

## 5  Arguments

1:    $\mathbf{order}$Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 2.3.1.3 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2:    $\mathbf{uplo}$Nag_UploTypeInput
On entry: specifies how $A$ has been factorized.
${\mathbf{uplo}}=\mathrm{Nag_Upper}$
$A={U}^{\mathrm{T}}U$, where $U$ is upper triangular.
${\mathbf{uplo}}=\mathrm{Nag_Lower}$
$A=L{L}^{\mathrm{T}}$, where $L$ is lower triangular.
Constraint: ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $\mathrm{Nag_Lower}$.
3:    $\mathbf{n}$IntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
4:    $\mathbf{ap}\left[\mathit{dim}\right]$doubleInput/Output
Note: the dimension, dim, of the array ap must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$.
On entry: the Cholesky factor of $A$ stored in packed form, as returned by nag_dpptrf (f07gdc).
On exit: the factorization is overwritten by the $n$ by $n$ matrix ${A}^{-1}$.
The storage of elements ${A}_{ij}$ depends on the order and uplo arguments as follows:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
${A}_{ij}$ is stored in ${\mathbf{ap}}\left[\left(j-1\right)×j/2+i-1\right]$, for $i\le j$;
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Lower}$,
${A}_{ij}$ is stored in ${\mathbf{ap}}\left[\left(2n-j\right)×\left(j-1\right)/2+i-1\right]$, for $i\ge j$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
${A}_{ij}$ is stored in ${\mathbf{ap}}\left[\left(2n-i\right)×\left(i-1\right)/2+j-1\right]$, for $i\le j$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Lower}$,
${A}_{ij}$ is stored in ${\mathbf{ap}}\left[\left(i-1\right)×i/2+j-1\right]$, for $i\ge j$.
5:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 2.7 in How to Use the NAG Library and its Documentation).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_SINGULAR
Diagonal element $〈\mathit{\text{value}}〉$ of the Cholesky factor is zero; the Cholesky factor is singular and the inverse of $A$ cannot be computed.

## 7  Accuracy

The computed inverse $X$ satisfies
 $XA-I2≤cnεκ2A and AX-I2≤cnεκ2A ,$
where $c\left(n\right)$ is a modest function of $n$, $\epsilon$ is the machine precision and ${\kappa }_{2}\left(A\right)$ is the condition number of $A$ defined by
 $κ2A=A2A-12 .$

## 8  Parallelism and Performance

nag_dpptri (f07gjc) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The total number of floating-point operations is approximately $\frac{2}{3}{n}^{3}$.
The complex analogue of this function is nag_zpptri (f07gwc).

## 10  Example

This example computes the inverse of the matrix $A$, where
 $A= 4.16 -3.12 0.56 -0.10 -3.12 5.03 -0.83 1.18 0.56 -0.83 0.76 0.34 -0.10 1.18 0.34 1.18 .$
Here $A$ is symmetric positive definite, stored in packed form, and must first be factorized by nag_dpptrf (f07gdc).

### 10.1  Program Text

Program Text (f07gjce.c)

### 10.2  Program Data

Program Data (f07gjce.d)

### 10.3  Program Results

Program Results (f07gjce.r)