MATHEMATICAL OPERATORS MATRIX AND STRING ARRAY OPERATORS
+ addition | matrix vertical concatenation
- subtraction or unary minus ~ matrix horizontal concatenation
* multiplication $| string array vert concatenation
.* ExE multiplication $~ string array horiz concatenation
^ ExE exponentiation ' transpose
! factorial .' bookkeeping transpose
./ ExE division
/ division or linear equation solution of Ax = b, for example: x = b/A;
% modulo division
.*. Kronecker product STRING OPERATORS
*~ horizontal direct product $+ string concatenation
Symbols used for indexing matrices are: "[", "]", "." and ":". For example,
x[1 2 5] returns the 1st, 2nd and 5th elements of x.
x[2:10] returns the 2nd through 10th elements of x.
x[.,2 4 6] returns all rows of the 2nd, 4th, and 6th columns of x.
'{' and '}' are used to create matrices. For example, x = { 1 2 3 }. See LET.
Less than: Not equal:
z = x < y; z = x /= y;
z = x LT y; z = x NE y;
z = x $< y; z = x $/= y;
Greater than: Greater than or equal to:
z = x > y; z = x >= y;
z = x GT y; z = x GE y;
z = x $> y; z = x $>= y;
Equal to: Less than or equal to:
z = x == y; z = x <= y;
z = x EQ y; z = x LE y;
z = x $== y; z = x $<= y;
The result is a scalar 1 or 0, based upon a comparison of all elements of x
and y. ALL comparisons must be true for a result of 1 (TRUE).
The "$" is used for comparisons between character data and other nonnumeric
data, e.g. NANs.
Less than: Not equal:
z = x .< y; z = x ./= y;
z = x .LT y; z = x .NE y;
z = x .$< y; z = x .$/= y;
Greater than: Greater than or equal to:
z = x .> y; z = x .>= y;
z = x .GT y; z = x .GE y;
z = x .$> y; z = x .$>= y;
Equal to: Less than or equal to:
z = x .== y; z = x .<= y;
z = x .EQ y; z = x .LE y;
z = x .$== y; z = x .$<= y;
The above operators all produce a matrix of 0's and 1's, with a 1 where the
corresponding comparison is TRUE.
The "$" is used for comparisons between character data and other nonnumeric
data, e.g. NANs.
The logical operators perform logical or Boolean operations on numeric
values. On input, a nonzero value is considered TRUE and a zero value
is considered FALSE. The logical operators return a 1 if TRUE and a 0 if
FALSE.
These operators require scalar arguments. These are the ones to use in
If and DO statements:
* Complement * Disjunction * Equivalence
z = NOT x; z = x OR y; z = x EQV y;
* Conjunction * Exclusive OR
z = x AND y; z = x XOR y;
The matrix logical operators perform logical or Boolean operations on numeric values. On input, a nonzero value is considered TRUE and a zero value is considered FALSE. The logical operators return a 1 if TRUE and a 0 if FALSE.
* Complement * Disjunction * Equivalence
z = .NOT x; z = x .OR y; z = x .EQV y;
* Conjunction * Exclusive OR
z = x .AND y; z = x .XOR y;
If the logical operator is preceded by a dot ".", the result will be a matrix of 1's and 0's based upon an element-by-element logical comparison of x and y. For example, if
x = { 0 1 0 1 } and y = { 1 1 0 0 }
then (x .OR y) will be the vector { 1 1 0 1 }. Do not use the "." operators
in IF or DO...WHILE statements.