Viewing the Contents of a Matrix


A large percentage of scientific programming effort involves computations on matrix values. Let us assume that the user, a scientific programmer, has a numerical application that computes a matrix in tridiagonal form (that is, consisting of non-zero eleme nts only along the diagonals). The fastest way to verify that only diagonal elements are filled, is to examine a visual representation of the matrix [3,17]. To do this using MCF, the user uses a single print statement or utility call to record the dimensi ons and values of the matrix in a file, then invokes xmatcmp with this file as input. (Section 4 for details on generating MCF file formats). Since very few elements are expected to have non-zero values, the matrix contents may be stored in s parse format.

The tool displays the result as shown in the figure below. The colors in the display may to the size ranges shown in the Color Key window. For example, if an element is colored red, its value is greater than 6.0 From this display the user can easily obser ve the pattern of values. By recording matrix values at different points in the computation, the user can view the progress of the algorithm or generate a series of animation frames. If the user is concerned about the values of one or more specific elemen ts in the matrix, he/she can position the cursor over the corresponding square. The message area at the bottom of the main window displays the indices and value of that element. In the figure, for example, the diagonal elements at the lower right are all red. By moving the cursor across them, the user finds that they are all quite large values (indication of a problem with the algorithm).

In this example, all values in the matrix are positive. In other circumstances, the matrix might contain both positive and negative values, and the user may want to see only the elements that are greater then zero. He/she can select the LE operator from t he Control area at the bottom of the window - that is, elements less than or equal to zero should be ignored. The colors in the viewing area will change. Elements that are not white have a value greater than zero. The same effect can be achieved by invoki ng the tool with the LE operator and the constant zero as the last argument.

Verifiying the Correctness of Intermediate Results

Back to MCF home page


Back to Pancake home page