# NAG CL Interfaceg01kqc (pdf_​normal_​vector)

Settings help

CL Name Style:

## 1Purpose

g01kqc returns a number of values of the probability density function (PDF), or its logarithm, for the Normal (Gaussian) distributions.

## 2Specification

 #include
 void g01kqc (Nag_Boolean ilog, Integer lx, const double x[], Integer lxmu, const double xmu[], Integer lxstd, const double xstd[], double pdf[], Integer ivalid[], NagError *fail)
The function may be called by the names: g01kqc, nag_stat_pdf_normal_vector or nag_normal_pdf_vector.

## 3Description

The Normal distribution with mean ${\mu }_{i}$, variance ${{\sigma }_{i}}^{2}$; has probability density function (PDF)
 $f (xi,μi,σi) = 1 σi⁢2π e -(xi-μi)2/2σi2 , σi>0 .$
The input arrays to this function are designed to allow maximum flexibility in the supply of vector arguments by re-using elements of any arrays that are shorter than the total number of evaluations required. See Section 2.6 in the G01 Chapter Introduction for further information.
None.

## 5Arguments

1: $\mathbf{ilog}$Nag_Boolean Input
On entry: the value of ilog determines whether the logarithmic value is returned in PDF.
${\mathbf{ilog}}=\mathrm{Nag_FALSE}$
$f\left({x}_{i},{\mu }_{i},{\sigma }_{i}\right)$, the probability density function is returned.
${\mathbf{ilog}}=\mathrm{Nag_TRUE}$
$\mathrm{log}\left(f\left({x}_{i},{\mu }_{i},{\sigma }_{i}\right)\right)$, the logarithm of the probability density function is returned.
2: $\mathbf{lx}$Integer Input
On entry: the length of the array x.
Constraint: ${\mathbf{lx}}>0$.
3: $\mathbf{x}\left[{\mathbf{lx}}\right]$const double Input
On entry: ${x}_{i}$, the values at which the PDF is to be evaluated with ${x}_{i}={\mathbf{x}}\left[j\right]$, , for $i=1,2,\dots ,\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{lx}},{\mathbf{lxstd}},{\mathbf{lxmu}}\right)$.
4: $\mathbf{lxmu}$Integer Input
On entry: the length of the array xmu.
Constraint: ${\mathbf{lxmu}}>0$.
5: $\mathbf{xmu}\left[{\mathbf{lxmu}}\right]$const double Input
On entry: ${\mu }_{i}$, the means with ${\mu }_{i}={\mathbf{xmu}}\left[j\right]$, .
6: $\mathbf{lxstd}$Integer Input
On entry: the length of the array xstd.
Constraint: ${\mathbf{lxstd}}>0$.
7: $\mathbf{xstd}\left[{\mathbf{lxstd}}\right]$const double Input
On entry: ${\sigma }_{i}$, the standard deviations with ${\sigma }_{i}={\mathbf{xstd}}\left[j\right]$, .
Constraint: ${\mathbf{xstd}}\left[\mathit{j}-1\right]\ge 0.0$, for $\mathit{j}=1,2,\dots ,{\mathbf{lxstd}}$.
8: $\mathbf{pdf}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array pdf must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{lx}},{\mathbf{lxstd}},{\mathbf{lxmu}}\right)$.
On exit: $f\left({x}_{i},{\mu }_{i},{\sigma }_{i}\right)$ or $\mathrm{log}\left(f\left({x}_{i},{\mu }_{i},{\sigma }_{i}\right)\right)$.
9: $\mathbf{ivalid}\left[\mathit{dim}\right]$Integer Output
Note: the dimension, dim, of the array ivalid must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{lx}},{\mathbf{lxstd}},{\mathbf{lxmu}}\right)$.
On exit: ${\mathbf{ivalid}}\left[i-1\right]$ indicates any errors with the input arguments, with
${\mathbf{ivalid}}\left[i-1\right]=0$
No error.
${\mathbf{ivalid}}\left[i-1\right]=1$
${\sigma }_{i}<0$.
10: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_ARRAY_SIZE
On entry, $\text{array size}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lx}}>0$.
On entry, $\text{array size}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lxmu}}>0$.
On entry, $\text{array size}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lxstd}}>0$.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
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 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NW_IVALID
On entry, at least one value of xstd was invalid.

Not applicable.

## 8Parallelism and Performance

g01kqc is not threaded in any implementation.

None.

## 10Example

This example prints the value of the Normal distribution PDF at four different points ${x}_{i}$ with differing ${\mu }_{i}$ and ${\sigma }_{i}$.

### 10.1Program Text

Program Text (g01kqce.c)

### 10.2Program Data

Program Data (g01kqce.d)

### 10.3Program Results

Program Results (g01kqce.r)