# Matrix functions

## Matrix construction

• MAKE(r,c,[v])Creates a r × c matrix (r rows and c columns) with all elements equal to v.
• MAGIC(n) Creates a n × n matrix with as elements the integers 1 through n2, with equal row and column sums.
• MRND(r,c) Creates a r × c matrix (r rows and c columns) with random numbers.
• DIAG(A) Creates a diagonal matrix.
• UNIT(A) Returns a unit matrix with the same dimensions of the square matrix A.
• ONES(A) returns a matrix with the same dimensions as matrix A with all elements equal to 1.
• ZERO(A) Returns a matrix with the same dimensions as matrix A with all elements equal to zero.
• CVEC(min,max,n) Returns a column vector with n number or rows, with evenly spaced values ranging from min to max.
• RVEC(min,max,n) Returns a row vector with n number or columns, with evenly spaced values ranging from min to max .

## Add and remove columns and rows

• CBIND(A,B[,..]) Returns a matrix with matrix B appended to matrix A, columnswise.
• RBIND(A,B[,..]) Returns a matrix with matrix B appended to matrix A, rowwise.
• CDEL(A,c) Returns the matrix A without column c.
• RDEL(A,r) Returns the matrix A without row r.

## Matrix properties

• INDEX(A,r,c) Returns an element, row, or column of a matrix.
• NORM(A) Returns the 2-norm of a vector or matrix.
• NCOL(A) Returns the number of columns of a matrix.
• NROW(A) Returns the number of rows of a matrix.
• TRACE(A) Returns the sum of the elements on the main diagonal of a matrix.

## Matrix Operations and Transformations

• KRON(A,B) Returns the Kronecker tensor product of matrices A and B.
• INV(A) Returns the inverse matrix of a matrix.
• PINV(A) Returns the Moore-Penrose Pseudoinverse of a matrix.
• RANK(A) Returns an estimate of the number of linearly independent rows or columns of a matrix.
• TRANSPOSE(A) Returns the transpose of a matrix.

## Linear Equations

• BALANCE(A) Returns a better-balanced matrix with the same eigenvalues.
• DETERM(A) Returns the determinant of a matrix.
• HESSENBERG(A) Generates a Hessenberg matrix.
• EIG(A[,v]) Returns the Eigenvalues of matrix A.
• SOLVE(A,B) Solves the equation AX=B for X.
• MCOV(A) Returns the variance-covariance matrix.
• MCOR(A) Returns the correlation matrix.
• SSCP(A) Returns a matrix with sums of squares and cross-products.

## Matrix statistical functions

• CMAX(A) Returns a row vector with column maxima.
• CMIN(A) Returns a row vector with column minima.
• CSSQ(A) Returns a row vector with the sum of the squared values of each column.
• CSUM(A) Returns a row vector with column totals.
• MMAX(A) Returns the numerically maximum value in a matrix.
• MMIN(A) Returns the numerically minimum value in a matrix.
• MSSQ(A) Returns the sum of the squared values of all of the elements in a matrix.
• MSUM(A) Returns the sum of all of the elements in a matrix.
• RMAX(A) Returns a column vector with row maxima.
• RMIN(A) Returns a column vector with row minima.
• RSSQ(A) Returns a column vector with the sum of the squared values of each row.
• RSUM(A) Returns a row vector with row totals.