The command line version of the tool does not provide as much detailed information as xmatcmp, but it can be used quickly to obtain a subset of the same information. All output is textual.
Suppose the user has an application that uses inverse matrices for computations. The application first finds the inverse of a given matrix, and then performs further calculations. If the inverse matrix is computed incorrectly, the rest of the computation
will also suffer. If the computation was correct, the user should get the identity matrix when he/she multiplies the given matrix with its inverse. The user can store the result of this matrix multiplication in a file, and invoke matcmp namin
g the file, the EQ operator, and a file containing an identity matrix of the appropriate size as input (see Sample output for the command line version). If the inverse is correct, the output would indicate that no mismatches had been found. Instead, the o
utput lists a total of 3600 mismatches, signifying that all elements of the 60x60 matrix are incorrect.
Prompt> matcmp verify_matrix EQ identity
*** Test: verify_matrix EQ identity (tol = 0.0000000000e+00)***
Number of mismatches: 3600
Magnitude of average mismatch: 1.5324500000e+1
Magnitude of worst case mismatch: 2.107915000e+1
Sample output for the command line version.
If the user suspects that the mismatches shown in above are due to round-off errors, he/she may include a tolerance value while invoking the tool with the above matrices (see Verifying identity matrix within a threshold value). Only differences exceeding the tolerance will be reported as mismatches. The tool still reports mismatches, thereby indicating that the inverse matrix was genuinely incorrect.
Prompt> matcmp -tol 0.572 verify_matrix EQ identity
***Test: verify_matrix EQ identity (tol = 0.57200000000e+00)***
Number of mismatches: 2703
Magnitude of average mismatch: 1.1127500000e+1
Magnitude of worst case mismatch: 2.1079150000e+1
Verifying identity matrix within a threshold value.
Now suppose the user has an application which manipulates a large matrix representing geographical data. Before using the matrix in computation, it must first be initialized properly. Let us assume that the user suspect the initialization is not taking pl
ace. To verify this, the user records the contents of the matrix after the initialization routine has been completed. matcmp is invoked on these values, as shown below. No mismatches are reported, indicating that the array remained in its uni
nitialized (all zeros) state.
Prompt> matcmp array_values EQ 0
***Test: array_values EQ 0 (tol = 0.0000000000e+00) ***
No mismatches found
Verifying array initialization.