# NAG CL Interfaceg02lac (pls_​svd)

## 1Purpose

g02lac fits an orthogonal scores partial least squares (PLS) regression by using singular value decomposition.

## 2Specification

 #include
 void g02lac (Nag_OrderType order, Integer n, Integer mx, const double x[], Integer pdx, const Integer isx[], Integer ip, Integer my, const double y[], Integer pdy, double xbar[], double ybar[], Nag_ScalePredictor iscale, double xstd[], double ystd[], Integer maxfac, double xres[], Integer pdxres, double yres[], Integer pdyres, double w[], Integer pdw, double p[], Integer pdp, double t[], Integer pdt, double c[], Integer pdc, double u[], Integer pdu, double xcv[], double ycv[], Integer pdycv, NagError *fail)
The function may be called by the names: g02lac, nag_correg_pls_svd or nag_pls_orth_scores_svd.

## 3Description

Let ${X}_{1}$ be the mean-centred $n$ by $m$ data matrix $X$ of $n$ observations on $m$ predictor variables. Let ${Y}_{1}$ be the mean-centred $n$ by $r$ data matrix $Y$ of $n$ observations on $r$ response variables.
The first of the $k$ factors PLS methods extract from the data predicts both ${X}_{1}$ and ${Y}_{1}$ by regressing on ${t}_{1}$ a column vector of $n$ scores:
 $X^1 = t1 p1T Y^1 = t1 c1T , with ​ t1T t1 = 1 ,$
where the column vectors of $m$ $x$-loadings ${p}_{1}$ and $r$ $y$-loadings ${c}_{1}$ are calculated in the least squares sense:
 $p1T = t1T X1 c1T = t1T Y1 .$
The $x$-score vector ${t}_{1}={X}_{1}{w}_{1}$ is the linear combination of predictor data ${X}_{1}$ that has maximum covariance with the $y$-scores ${u}_{1}={Y}_{1}{c}_{1}$, where the $x$-weights vector ${w}_{1}$ is the normalised first left singular vector of ${X}_{1}^{\mathrm{T}}{Y}_{1}$.
The method extracts subsequent PLS factors by repeating the above process with the residual matrices:
 $Xi = Xi-1 - X^ i-1 Yi = Yi-1 - Y^ i-1 , i=2,3,…,k ,$
and with orthogonal scores:
 $tiT tj = 0 , j=1,2,…,i-1 .$
Optionally, in addition to being mean-centred, the data matrices ${X}_{1}$ and ${Y}_{1}$ may be scaled by standard deviations of the variables. If data are supplied mean-centred, the calculations are not affected within numerical accuracy.

None.

## 5Arguments

1: $\mathbf{order}$Nag_OrderType Input
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 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2: $\mathbf{n}$Integer Input
On entry: $n$, the number of observations.
Constraint: ${\mathbf{n}}>1$.
3: $\mathbf{mx}$Integer Input
On entry: the number of predictor variables.
Constraint: ${\mathbf{mx}}>1$.
4: $\mathbf{x}\left[\mathit{dim}\right]$const double Input
Note: the dimension, dim, of the array x must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdx}}×{\mathbf{mx}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdx}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
where ${\mathbf{X}}\left(i,j\right)$ appears in this document, it refers to the array element
• ${\mathbf{x}}\left[\left(j-1\right)×{\mathbf{pdx}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{x}}\left[\left(i-1\right)×{\mathbf{pdx}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: ${\mathbf{X}}\left(\mathit{i},\mathit{j}\right)$ must contain the $\mathit{i}$th observation on the $\mathit{j}$th predictor variable, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{mx}}$.
5: $\mathbf{pdx}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array x.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdx}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdx}}\ge {\mathbf{mx}}$.
6: $\mathbf{isx}\left[{\mathbf{mx}}\right]$const Integer Input
On entry: indicates which predictor variables are to be included in the model.
${\mathbf{isx}}\left[j-1\right]=1$
The $j$th predictor variable (with variates in the $j$th column of $X$) is included in the model.
${\mathbf{isx}}\left[j-1\right]=0$
Otherwise.
Constraint: the sum of elements in isx must equal ip.
7: $\mathbf{ip}$Integer Input
On entry: $m$, the number of predictor variables in the model.
Constraint: $1<{\mathbf{ip}}\le {\mathbf{mx}}$.
8: $\mathbf{my}$Integer Input
On entry: $r$, the number of response variables.
Constraint: ${\mathbf{my}}\ge 1$.
9: $\mathbf{y}\left[\mathit{dim}\right]$const double Input
Note: the dimension, dim, of the array y must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdy}}×{\mathbf{my}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdy}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
where ${\mathbf{Y}}\left(i,j\right)$ appears in this document, it refers to the array element
• ${\mathbf{y}}\left[\left(j-1\right)×{\mathbf{pdy}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{y}}\left[\left(i-1\right)×{\mathbf{pdy}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: ${\mathbf{Y}}\left(\mathit{i},\mathit{j}\right)$ must contain the $\mathit{i}$th observation for the $\mathit{j}$th response variable, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{my}}$.
10: $\mathbf{pdy}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array y.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdy}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdy}}\ge {\mathbf{my}}$.
11: $\mathbf{xbar}\left[{\mathbf{ip}}\right]$double Output
On exit: mean values of predictor variables in the model.
12: $\mathbf{ybar}\left[{\mathbf{my}}\right]$double Output
On exit: the mean value of each response variable.
13: $\mathbf{iscale}$Nag_ScalePredictor Input
On entry: indicates how predictor variables are scaled.
${\mathbf{iscale}}=\mathrm{Nag_PredStdScale}$
Data are scaled by the standard deviation of variables.
${\mathbf{iscale}}=\mathrm{Nag_PredUserScale}$
Data are scaled by user-supplied scalings.
${\mathbf{iscale}}=\mathrm{Nag_PredNoScale}$
No scaling.
Constraint: ${\mathbf{iscale}}=\mathrm{Nag_PredNoScale}$, $\mathrm{Nag_PredStdScale}$ or $\mathrm{Nag_PredUserScale}$.
14: $\mathbf{xstd}\left[{\mathbf{ip}}\right]$double Input/Output
On entry: if ${\mathbf{iscale}}=\mathrm{Nag_PredUserScale}$, ${\mathbf{xstd}}\left[\mathit{j}-1\right]$ must contain the user-supplied scaling for the $\mathit{j}$th predictor variable in the model, for $\mathit{j}=1,2,\dots ,{\mathbf{ip}}$. Otherwise xstd need not be set.
On exit: if ${\mathbf{iscale}}=\mathrm{Nag_PredStdScale}$, standard deviations of predictor variables in the model. Otherwise xstd is not changed.
15: $\mathbf{ystd}\left[{\mathbf{my}}\right]$double Input/Output
On entry: if ${\mathbf{iscale}}=\mathrm{Nag_PredUserScale}$, ${\mathbf{ystd}}\left[\mathit{j}-1\right]$ must contain the user-supplied scaling for the $\mathit{j}$th response variable in the model, for $\mathit{j}=1,2,\dots ,{\mathbf{my}}$. Otherwise ystd need not be set.
On exit: if ${\mathbf{iscale}}=\mathrm{Nag_PredStdScale}$, the standard deviation of each response variable. Otherwise ystd is not changed.
16: $\mathbf{maxfac}$Integer Input
On entry: $k$, the number of latent variables to calculate.
Constraint: $1\le {\mathbf{maxfac}}\le {\mathbf{ip}}$.
17: $\mathbf{xres}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array xres must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdxres}}×{\mathbf{ip}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdxres}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
the $\left(i,j\right)$th element of the matrix is stored in
• ${\mathbf{xres}}\left[\left(j-1\right)×{\mathbf{pdxres}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{xres}}\left[\left(i-1\right)×{\mathbf{pdxres}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the predictor variables' residual matrix ${X}_{k}$.
18: $\mathbf{pdxres}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array xres.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdxres}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdxres}}\ge {\mathbf{ip}}$.
19: $\mathbf{yres}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array yres must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdyres}}×{\mathbf{my}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdyres}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
the $\left(i,j\right)$th element of the matrix is stored in
• ${\mathbf{yres}}\left[\left(j-1\right)×{\mathbf{pdyres}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{yres}}\left[\left(i-1\right)×{\mathbf{pdyres}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the residuals for each response variable, ${Y}_{k}$.
20: $\mathbf{pdyres}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array yres.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdyres}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdyres}}\ge {\mathbf{my}}$.
21: $\mathbf{w}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array w must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdw}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{ip}}×{\mathbf{pdw}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
the $\left(i,j\right)$th element of the matrix $W$ is stored in
• ${\mathbf{w}}\left[\left(j-1\right)×{\mathbf{pdw}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{w}}\left[\left(i-1\right)×{\mathbf{pdw}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $W$ contains the $x$-weights ${w}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
22: $\mathbf{pdw}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array w.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdw}}\ge {\mathbf{ip}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdw}}\ge {\mathbf{maxfac}}$.
23: $\mathbf{p}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array p must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdp}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{ip}}×{\mathbf{pdp}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
the $\left(i,j\right)$th element of the matrix $P$ is stored in
• ${\mathbf{p}}\left[\left(j-1\right)×{\mathbf{pdp}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{p}}\left[\left(i-1\right)×{\mathbf{pdp}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $P$ contains the $x$-loadings ${p}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
24: $\mathbf{pdp}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array p.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdp}}\ge {\mathbf{ip}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdp}}\ge {\mathbf{maxfac}}$.
25: $\mathbf{t}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array t must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdt}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdt}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
the $\left(i,j\right)$th element of the matrix $T$ is stored in
• ${\mathbf{t}}\left[\left(j-1\right)×{\mathbf{pdt}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{t}}\left[\left(i-1\right)×{\mathbf{pdt}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $T$ contains the $x$-scores ${t}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
26: $\mathbf{pdt}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array t.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdt}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdt}}\ge {\mathbf{maxfac}}$.
27: $\mathbf{c}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array c must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdc}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{my}}×{\mathbf{pdc}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
the $\left(i,j\right)$th element of the matrix $C$ is stored in
• ${\mathbf{c}}\left[\left(j-1\right)×{\mathbf{pdc}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{c}}\left[\left(i-1\right)×{\mathbf{pdc}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $C$ contains the $y$-loadings ${c}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
28: $\mathbf{pdc}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array c.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdc}}\ge {\mathbf{my}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdc}}\ge {\mathbf{maxfac}}$.
29: $\mathbf{u}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array u must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdu}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdu}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
the $\left(i,j\right)$th element of the matrix $U$ is stored in
• ${\mathbf{u}}\left[\left(j-1\right)×{\mathbf{pdu}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{u}}\left[\left(i-1\right)×{\mathbf{pdu}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $U$ contains the $y$-scores ${u}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
30: $\mathbf{pdu}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array u.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdu}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdu}}\ge {\mathbf{maxfac}}$.
31: $\mathbf{xcv}\left[{\mathbf{maxfac}}\right]$double Output
On exit: ${\mathbf{xcv}}\left[\mathit{j}-1\right]$ contains the cumulative percentage of variance in the predictor variables explained by the first $\mathit{j}$ factors, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
32: $\mathbf{ycv}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array ycv must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdycv}}×{\mathbf{my}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{maxfac}}×{\mathbf{pdycv}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
where ${\mathbf{YCV}}\left(i,j\right)$ appears in this document, it refers to the array element
• ${\mathbf{ycv}}\left[\left(j-1\right)×{\mathbf{pdycv}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{ycv}}\left[\left(i-1\right)×{\mathbf{pdycv}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: ${\mathbf{YCV}}\left(\mathit{i},\mathit{j}\right)$ is the cumulative percentage of variance of the $\mathit{j}$th response variable explained by the first $\mathit{i}$ factors, for $\mathit{i}=1,2,\dots ,{\mathbf{maxfac}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{my}}$.
33: $\mathbf{pdycv}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array ycv.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdycv}}\ge {\mathbf{maxfac}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdycv}}\ge {\mathbf{my}}$.
34: $\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.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{mx}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{mx}}>1$.
On entry, ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{my}}\ge 1$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}>1$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}>0$.
On entry, ${\mathbf{pdp}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdp}}>0$.
On entry, ${\mathbf{pdt}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdt}}>0$.
On entry, ${\mathbf{pdu}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdu}}>0$.
On entry, ${\mathbf{pdw}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdw}}>0$.
On entry, ${\mathbf{pdx}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdx}}>0$.
On entry, ${\mathbf{pdxres}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdxres}}>0$.
On entry, ${\mathbf{pdy}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdy}}>0$.
On entry, ${\mathbf{pdycv}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdycv}}>0$.
On entry, ${\mathbf{pdyres}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdyres}}>0$.
NE_INT_2
On entry, ${\mathbf{ip}}=〈\mathit{\text{value}}〉$ and ${\mathbf{mx}}=〈\mathit{\text{value}}〉$.
Constraint: $1<{\mathbf{ip}}\le {\mathbf{mx}}$.
On entry, ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$ and ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{maxfac}}\le {\mathbf{ip}}$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$ and ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}\ge {\mathbf{my}}$.
On entry, ${\mathbf{pdp}}=〈\mathit{\text{value}}〉$ and ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdp}}\ge {\mathbf{ip}}$.
On entry, ${\mathbf{pdp}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdp}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdt}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdt}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdt}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdt}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdu}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdu}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdu}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdu}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdw}}=〈\mathit{\text{value}}〉$ and ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdw}}\ge {\mathbf{ip}}$.
On entry, ${\mathbf{pdw}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdw}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdx}}=〈\mathit{\text{value}}〉$ and ${\mathbf{mx}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdx}}\ge {\mathbf{mx}}$.
On entry, ${\mathbf{pdx}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdx}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdxres}}=〈\mathit{\text{value}}〉$ and ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdxres}}\ge {\mathbf{ip}}$.
On entry, ${\mathbf{pdxres}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdxres}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdy}}=〈\mathit{\text{value}}〉$ and ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdy}}\ge {\mathbf{my}}$.
On entry, ${\mathbf{pdy}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdy}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdycv}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdycv}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdycv}}=〈\mathit{\text{value}}〉$ and ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdycv}}\ge {\mathbf{my}}$.
On entry, ${\mathbf{pdyres}}=〈\mathit{\text{value}}〉$ and ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdyres}}\ge {\mathbf{my}}$.
On entry, ${\mathbf{pdyres}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdyres}}\ge {\mathbf{n}}$.
NE_INT_ARG_CONS
On entry, ${\mathbf{ip}}=〈\mathit{\text{value}}〉$ and $\mathrm{sum}\left({\mathbf{isx}}\right)=〈\mathit{\text{value}}〉$.
Constraint: the sum of elements in isx must equal ip.
NE_INT_ARRAY_VAL_1_OR_2
On entry, ${\mathbf{isx}}\left[〈\mathit{\text{value}}〉\right]$ is invalid.
Constraint: ${\mathbf{isx}}\left[j-1\right]=0$ or $1$, for all $j$.
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.

## 7Accuracy

The computed singular value decomposition is nearly the exact singular value decomposition for a nearby matrix $\left(A+E\right)$, where
 $E2 = Oε A2 ,$
and $\epsilon$ is the machine precision.

## 8Parallelism and Performance

g02lac 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.

g02lac allocates internally $2mr+A+\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(3\left(A+B\right),5A\right)+r$ elements of double storage, where $A=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,r\right)$ and $B=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(m,r\right)$.

## 10Example

This example reads in data from an experiment to measure the biological activity in a chemical compound, and a PLS model is estimated.

### 10.1Program Text

Program Text (g02lace.c)

### 10.2Program Data

Program Data (g02lace.d)

### 10.3Program Results

Program Results (g02lace.r)