## Input Matrix Formatting

The specific formatting of records for the "covariance matrix" of 2DC, 2DD, 3DC, and 3DD groups of observations depends on the form of covariance information you have for the observation group.

The most common type of covariance matrix data provided for coordinate and coordinate difference measurements are the actual elements of a covariance matrix (in which case you must use a COV matrix header record). Other forms handled by GeoLab are weight matrix elements (WGT header record), correlation matrix elements (CORR header record), or you can generate a covariance matrix (e.g. for simulations) using the GENC header record (which requires no ELEM records).

The required size of the matrix (which determines the number of ELEM records in the "Matrix elements records" section) is determined by the number N of records in the "Set of measurement value records" as follows:

For example, if we have the following three (N = 3) sets of coordinate difference observations:

for a total of nine observations (3 sets of dX, dY, and dZ), we would input them in three DXYZ records as follows:

3DD

DXYZ12 d1 d2 d3

DXYZ23 d4 d5 d6

DXYZ31 d7 d8 d9

The most common type of covariance matrix data provided for coordinate and coordinate difference measurements are the actual elements of a covariance matrix (in which case you must use a COV matrix header record). Other forms handled by GeoLab are weight matrix elements (WGT header record), correlation matrix elements (CORR header record), or you can generate a covariance matrix (e.g. for simulations) using the GENC header record (which requires no ELEM records).

The required size of the matrix (which determines the number of ELEM records in the "Matrix elements records" section) is determined by the number N of records in the "Set of measurement value records" as follows:

- 2DC: obs = PL, NE, XY; matrix size = 2 * N.
- 2DD: obs = PL, NE, XY; matrix size = 2 * (N - 1).
- 3DC: obs = PLH, PLO, NEH, NEO, XYZ; ; matrix size = 3 * N.
- 3DD: obs = PLH, PLO, NEH, NEO, XYZ; matrix size = 3 * (N - 1).
- 3DD: obs = DXYZ; matrix size = 3 * N.

For example, if we have the following three (N = 3) sets of coordinate difference observations:

- Station 1 to station 2: d1 = X2 - X1; d2 = Y2 - Y1; d3 = Z2 - Z1;
- Station 2 to station 3: d4 = X3 - X2; d5 = Y3 - Y2; d6 = Z3 - Z2;
- Station 3 to station 1: d7 = X3 - X1; d8 = Y3 - Y1; d9 = Z3 - Z1;

for a total of nine observations (3 sets of dX, dY, and dZ), we would input them in three DXYZ records as follows:

3DD

DXYZ12 d1 d2 d3

DXYZ23 d4 d5 d6

DXYZ31 d7 d8 d9

If we denote a covariance matrix element as sij (where s11 is the variance of d1, and s12 is the covariance between d1 and d2, etc.) the upper-triangular portion of the covariance matrix for these observations is as shown in the figure (note that the order of the covariance elements depends only on the order in which the observations are given as DXYZ records). |

The COV and ELEM records for this observation would therefore be:

COV CT UPPR

ELEM s11 s12 s13

ELEM s14 s15 s16

ELEM s17 s18 s19

ELEM s22 s23 s24

ELEM s25 s26 s27

ELEM s28 s29

ELEM s33 s34 s35

ELEM s36 s37 s38

ELEM s39

ELEM s44 s45 s46

ELEM s47 s48 s49

ELEM s55 s56 s57

ELEM s58 s59

ELEM s66 s67 s68

ELEM s69

ELEM s77 s78 s79

ELEM s88 s89

ELEM s99

As you can see, the general approach is to start the entry of each row of the upper-triangular portion of the matrix with a new ELEM record, and you use as many ELEM records as required for the elements of each row (an ELEM record can hold up to three elements). For the UPPR matrix form, each row is entered starting with the diagonal element. For the DIAG matrix form, you simply enter the diagonal elements (three at a time) in ELEM records from the upper-left element to the lower-right element.

The structure of the ELEM records is similar when you use the WGT matrix header (except, of course, weight matrix elements are entered instead of covariance matrix elements).

The structure of the ELEM records is slightly different when you use the CORR matrix header record. In this case the diagonal elements must always be 1.0, and the off-diagonal elements are the correlation coefficients. Immediately following these elements, you must also provide ELEM records that specify the standard deviations of the coordinate or coordinate difference measurements. If the matrix size is N, then N standard deviations must be entered in as many ELEM records as required (an ELEM record can only contain up to three elements).

COV CT UPPR

ELEM s11 s12 s13

ELEM s14 s15 s16

ELEM s17 s18 s19

ELEM s22 s23 s24

ELEM s25 s26 s27

ELEM s28 s29

ELEM s33 s34 s35

ELEM s36 s37 s38

ELEM s39

ELEM s44 s45 s46

ELEM s47 s48 s49

ELEM s55 s56 s57

ELEM s58 s59

ELEM s66 s67 s68

ELEM s69

ELEM s77 s78 s79

ELEM s88 s89

ELEM s99

As you can see, the general approach is to start the entry of each row of the upper-triangular portion of the matrix with a new ELEM record, and you use as many ELEM records as required for the elements of each row (an ELEM record can hold up to three elements). For the UPPR matrix form, each row is entered starting with the diagonal element. For the DIAG matrix form, you simply enter the diagonal elements (three at a time) in ELEM records from the upper-left element to the lower-right element.

The structure of the ELEM records is similar when you use the WGT matrix header (except, of course, weight matrix elements are entered instead of covariance matrix elements).

The structure of the ELEM records is slightly different when you use the CORR matrix header record. In this case the diagonal elements must always be 1.0, and the off-diagonal elements are the correlation coefficients. Immediately following these elements, you must also provide ELEM records that specify the standard deviations of the coordinate or coordinate difference measurements. If the matrix size is N, then N standard deviations must be entered in as many ELEM records as required (an ELEM record can only contain up to three elements).