help matrix operators
-------------------------------------------------------------------------------
Title
Matrix operators
Description
Matrix operators are outlined here. See [P] matrix for background
information and links to more matrix help.
Let B and C represent matrix names or matrix expressions. Let z
represent numbers or scalar expressions.
The matrix monadic operators are
-B negation
B' transpose
The matrix dyadic operators are
B \ C add rows of C below rows of B (row join)
B , C add columns of C to the right of B (column join)
B + C addition
B - C subtraction
B * C multiplication (including mult. by scalar)
B / z division by scalar
B # C Kronecker product
Parentheses may be used to control order of evaluation. The default
order of precedence for the matrix operators (from highest to lowest) is
Operator Symbol
-----------------------------
parentheses ()
transpose '
negation -
Kronecker product #
division by scalar /
multiplication *
subtraction -
addition +
column join ,
row join \
-----------------------------
Examples
. matrix A = (1,2\3,4)
. matrix B = (5,7\9,2)
. matrix C = A+B
. matrix list C
. matrix B = A-B
. matrix list B
. matrix X = (1,1\2,5\8,0\4,5)
. matrix C = 3*X*A'*B
. matrix list C
. matrix D = (X'*X - A'*A)/4
. matrix rownames D = dog cat
. matrix colnames = bark meow
. matrix list D
. matrix rownames A = aa bb
. matrix colnames A = alpha beta
. matrix list A
. matrix D=A#D
. matrix list D
. matrix G=A,B\D
. matrix list G
. matrix Z = (B - A)'*(B + A'*-B)/4
. matrix list Z
Also see
Manual: [U] 14 Matrix expressions,
[P] matrix define
Help: [P] matrix; [P] matrix define, [D] functions (matrix functions)