Special Matrix Operations

Contents Index


diag(matrix) returns a matrix with the same diagonal entries as the argument, but zeroes off the diagonal.

diag(vector) returns a matrix with vector as its diagonal and 0 elsewhere.

vecdiag(squarematix) returns a vector whose entries are the diagonal entries of squarematrix.

call eigen(eval, evec, matrix) returns the vector of eigenvalues (eval) and matrix (evec) whose columns are the normalized eigenvectors of matrix. Matrix must be symmetric. In calling this routine, eval and evec are just names to be given to the returned matrices.

ginv(a) returns the Moore-Penrose generalized inverse of a.

ncol(a) returns the number of columns in the matrix a.

nrow(a) returns the number of rows in the matrix a.

shape(a,r,c) reshapes the matrix a to have r rows and c columns.

solve(a,b) solves the system ax=b for x. The answer is computed in a way that is more accurate than x=inv(a)*b.

call svd(u,q,v,a) returns the singular value decomposition (u*diag(q)*v`) of the specified matrix a. In calling this routine, u, q, andv are just names for the returned matrix values.

For more information see the online help under HELP--SAS SYSTEM--MODELING AND ANALYSIS TOOLS--INTERACTIVE MATRIX LANGUAGE or Chapter 7 of SAS/IML Software.


Contents Index

Copyright © 1997 by Jerry Alan Veeh. All rights reserved.