Language Reference |
FULL Function |
The FULL function converts a matrix stored in a sparse format into a matrix stored in a dense format. See the SPARSE function for a description of how sparse matrices are stored.
The arguments are as follows:
specifies a numerical matrix that contains a sparse representation of an matrix.
specifies the number of rows in the dense matrix. If this argument is not specified, then the number of rows is determined by the maximum value of the second column of x.
specifies the number of columns in the dense matrix. If this argument is not specified, then the number of columns is determined by the maximum value of the third column of x.
The matrix returned by the FULL function is an matrix with nonzero values determined by the x matrix, as shown in the following example:
s = {3 1 1, 1.1 2 1, 4 2 2, 1 3 2, 10 3 3, 3.2 4 2, 3 4 4 }; x = full(s); print x;
In the previous example, the s matrix specifies a lower triangular matrix. However, the s matrix might represent a symmetric matrix rather than a lower triangular matrix, but only the lower triangular entries were stored. (For example, the s matrix might have been created by the SPARSE function by using the "SYM" option; see the SPARSE function documentation.) If that is the case, you can use the following statement to recover the symmetric matrix representation of s:
xSym = (x+x`)- diag(x); print xSym;
By default, the size of the matrix returned by the FULL function is determined by the maximum row and column entry in the first argument. You can override this behavior by specifying values for the number of rows and columns returned by the FULL function, as shown in the following statements:
z = full(s, 5, 6); print z;
Copyright © SAS Institute, Inc. All Rights Reserved.