MATRIX _ _ _ _ _ _ _ _ _ _ _ _ declaration
Identifiers are declared to be of type matrix.
matrix<identifier> _ _ _ option (<index>,<index>)
{,<identifier> _ _ _ option (<index>,<index>)}*
<identifier> must not be an already-defined operator or array or the name of a scalar variable. Dimensions are optional, and if used appear inside parentheses. <index> must be a positive integer.
matrix a,b(1,4),c(4,4); b(1,1); 0 a(1,1); ***** Matrix A not set a := mat((x0,y0),(x1,y1)); A(1,1) := X0 A(1,2) := Y0 A(2,1) := X0 A(2,2) := X1 length a; {2,2} b := a**2; 2 B(1,1) := X0 + X1*Y0 B(1,2) := Y0*(X0 + Y1) B(2,1) := X1*(X0 + Y1) 2 B(2,2) := X1*Y0 + Y1
When a matrix variable has not been dimensioned, matrix elements c annot be referenced until the matrix is set by the mat operator. When a matrix is dimensioned in its declaration, matrix elements are set to 0. Matrix elements cannot stand for themselves. When you use let on a matrix element, there is no effect unless the element contains a constant, in which case an error message is returned. The same behavior occurs with clear. Do <not> use clear to try to set a matrix element to 0. let statements can be applied to matrices as a whole, if the right-hand side of the expression is a matrix expression, and the left-hand side identifier has been declared to be a matrix.
Arithmetical operators apply to matrices of the correct dimensions. The operators + and - can be used with matrices of the same dimensions. The operator * can be used to multiply m x n matrices by n x p matrices. Matrix multiplication is non-commutative. Scalars can also be multiplied with matrices, with the result that each element of the matrix is multiplied by the scalar. The operator / applied to two matrices computes the first matrix multiplied by the inverse of the second, if the inverse exists, and produces an error message otherwise. Matrices can be divided by scalars, which results in dividing each element of the matrix. Scalars can also be divided by matrices when the matrices are invertible, and the result is the multiplication of the scalar by the inverse of the matrix. Matrix inverses can by found by 1/A or /A, where A is a matrix. Square matrices can be raised to positive integer powers, and also to negative integer powers if they are nonsingular.
When a matrix variable is assigned to the results of a calculation, the matrix is redimensioned if necessary.