### SYNOPSYS

void slaFitxy(itype, np, xye)

int itype
int np
double ( *xye

### DESCRIPTION

```
Fit a linear model to relate two sets of [x,y] coordinates.

```

#### Given

```     itype    int            type of model: 4 or 6 (note 1)
np       int            number of samples (note 2)
xye      double[np]  expected [x,y] for each sample
xym      double[np]  measured [x,y] for each sample

```

#### Returned

```     coeffs   double      coefficients of model (note 3)
*j       int            status:  0 = OK
-1 = illegal itype
-2 = insufficient data
-3 = singular solution

```

#### Notes

```
1)  itype, which must be either 4 or 6, selects the type of model
fitted.  Both allowed itype values produce a model coeffs which
consists of six coefficients, namely the zero points and, for
each of xe and ye, the coefficient of xm and ym.  For itype=6,
all six coefficients are independent, modelling squash and shear
as well as origin, scale, and orientation.  However, itype=4
selects the "solid body rotation" option;  the model coeffs
still consists of the same six coefficients, but now two of
them are used twice (appropriately signed).  Origin, scale
and orientation are still modelled, but not squash or shear -
the units of x and y have to be the same.

2)  For nc=4, np must be at least 2.  For nc=6, np must be at
least 3.

3)  The model is returned in the array coeffs.  Naming the
```
elements of coeffs as follows
```
coeffs = a
coeffs = b
coeffs = c
coeffs = d
coeffs = e
coeffs = f

```
The model is
```
xe = a + b*xm + c*ym
ye = d + e*xm + f*ym

For the "solid body rotation" option (itype=4), the
magnitudes of b and f, and of c and e, are equal.  The
signs of these coefficients depend on whether there is a
sign reversal between xe,ye and xm,ym.  Fits are performed
with and without a sign reversal and the best one chosen.

4)  Error status values j=-1 and -2 leave coeffs unchanged;
If j=-3 coeffs may have been changed.

``` slaDmat, slaDmxv