matrix |

Declare and optionally initializes a matrix object.

Syntax

matrix(r, c) matrix_name[=assignment]

The matrix keyword is followed by the name you wish to give the matrix. matrix also takes an optional argument specifying the row r and column c dimension of the matrix. Once declared, matrices may be resized by repeating the matrix command using the original name.

You may combine matrix declaration and assignment. If there is no assignment statement, the matrix will initially be filled with zeros.

You should use sym for symmetric matrices.

Examples

matrix mom

declares a matrix named MOM with one element, initialized to zero.

matrix(3,6) coefs

declares a 3 by 6 matrix named COEFS, filled with zeros.

Cross-references

See “Matrix Language” for further discussion.