1. Home
2. LRV directive

# LRV directive

Declares one or more `LRV` data structures.

### Options

`ROWS` = scalar, vector or pointer Number of rows, or row labels, for the matrix; default `*` Number of columns, or column labels, for matrix and diagonal matrix; default `*`

### Parameters

`IDENTIFIER` = identifiers Identifiers of the LRVs Matrix to contain the latent vectors for each LRV Diagonal matrix to contain the latent roots for each LRV Trace of the matrix

### Description

The LRV is a compound data structure. These are similar to pointers in that they point to other structures, but they have a fixed number of elements which must be of the correct types and must form a consistent set (in terms of their sizes and so on). You can refer to elements of compound structures in exactly the same way as the elements of pointers, but the suffixes and their labels are fixed for each type of structure. Unlike pointers, the labels are also not case sensitive; Genstat will recognize the label in either upper case or lower case, or in any mixture of the two.

The LRV structure is used to store latent roots and vectors resulting from the decomposition of a matrix (by the `FLRV` directive), or produced in multivariate analysis. It points to three structures (identified by their suffixes):

    `[1]` or `['Vectors']` is a matrix whose columns are the latent vectors (the word `"Vector"` is used here in its mathematical sense rather than in the more specific Genstat sense; in fact, latent vectors are most conveniently stored in matrices rather than in Genstat vectors); is a diagonal matrix whose elements are the latent roots; is a scalar holding the trace of the matrix, which is the sum of all its latent roots.

The length of each latent vector is specified by the `ROWS` option; this then defines the number of rows in the `'VECTORS'` matrix. The `COLUMNS` option defines the number of latent roots to be stored; this is also the number of latent vectors, and so indicates the number of columns in the `'VECTORS'` matrix and the number of elements in the `'ROOTS'` matrix. If you do not specify the number of columns Genstat will set it to be the same as the number of rows. The value of `COLUMNS` can be less than the value of `ROWS`; however, it must not exceed than that of `ROWS`, otherwise Genstat gives an error diagnostic. Row and column labels can be defined, as in the `MATRIX` directive.

You can specify identifiers for the three individual elements of the LRV by using the `VECTORS`, `ROOTS` and `TRACE` parameters. If you have declared them already they must be of the correct type (and you can also have given them values). If you have given these identifiers row or column settings, then these will be used for the `LRV` declaration and must match any of the corresponding options of `LRV` that you choose to set.

Options: `ROWS`, `COLUMNS`.

Parameters: `IDENTIFIER`, `VECTORS`, `ROOTS`, `TRACE`.

Directives: `FLRV`, `DIAGONALMATRIX`, `MATRIX`, `POINTER`, `QRD`, `SVD`, `SYMMETRICMATRIX`.

Commands for: Data structures, Multivariate and cluster analysis.

### Example

```" Example LRV-1: Latent roots and vectors"

POINTER [VALUES=stem,leaf,root,petal,pollen] Vars
SYMMETRICMATRIX [ROWS=Vars] Symm
1.000
-0.655  1.000
-0.945  0.866  1.000
-0.756  0.000  0.500  1.000
0.500 -0.982 -0.756  0.189  1.000:
PRINT Symm

" Declare a latent roots and vectors structure"
LRV [ROWS=Vars; COLUMNS=2] Latent; VECTORS=Lvecs

" Form the values of the structure"
FLRV Symm; Latent
PRINT Latent['Vectors','Roots']
```
Updated on March 7, 2019