The keypad is used to enter operators into the expression being formed. The following table describes the meaning of each key on the pad.
Key | Genstat Expression | Mathematical expression | Notes | Description |
C = A + B | ci = ai + bi | Element-wise addition | ||
C = A − B | ci = ai − bi | Element-wise subtraction | ||
C = A * B | ci = ai × bi | 1 | Element-wise multiplication | |
C = A / B | ci = ai / bi | Element-wise division | ||
C = A .AND. B | ci = ai ∧ bi | 2,3 | Element-wise AND operation | |
C = A .OR. B | ci = ai ∨ bi | 2,4 | Element-wise OR operation | |
C = A .EQS. B | ci = 1.0 if ai = bi ci = 0.0 if ai ≠ bi |
5 | Element-wise string equality | |
C = A .NES. B | ci = 0.0 if ai = bi ci = 1.0 if ai ≠ bi |
5 | Element-wise string inequality | |
C = A ** B | ci = aibi | Element-wise exponentiation | ||
C = A *+ B | C = AB | 6 | Matrix product | |
( | ( | Left bracket. Used to control order of evaluation. Can be nested as many times as required | ||
) | ) | Right bracket. | ||
C = A == B | ci = 1.0 if ai = bi ci = 0.0 if ai ≠ bi |
Element-wise test of equality. Can also be typed in as .EQ. | ||
C = A /= B | ci = 1.0 if ai ≠ bi ci = 0.0 if ai = bi |
Element-wise test of inequality. Can also be typed in as .NE. | ||
C = A < B | ci = 1.0 if ai < bi ci = 0.0 if ai ≥ bi |
Element-wise less than. Can also be typed in as .LT. | ||
C = A <= B | ci = 1.0 if ai ≤ bi ci = 0.0 if ai > bi |
Element-wise less than or equal to. Can also be typed in as .LE. | ||
C = A > B | ci = 1.0 if ai > bi ci = 0.0 if ai ≤ bi |
Element-wise greater than. Can also be typed in as .GT. | ||
C = A >= B | ci = 1.0 if ai ≥ bi ci = 0.0 if ai < bi |
Element-wise greater than or equal to. Can also be typed in as .GE. | ||
C = A .IN. B | ci = 1.0 if ai ∈ B ci = 0.0 if ai ∉ bi |
7 | Element-wise test of set inclusion | |
C = A .NI. B | ci = 1.0 if ai ∈ B ci = 0.0 if ai ∉ bi |
7 | Element-wise test of set non-inclusion | |
B = NOT(A) | bi = ¬ ai | Element-wise logical negation (NOT). | ||
C = A .IS. B | 8,9 | Logical test of equivalence of identifiers. In the calculation C=A.IS.B the result C is 1 if A and B are identifiers of the same data structure, after any necessary substitutions (for example if B is a dummy in a FOR loop). The result is 0 if the identifiers are different. | ||
C = A .ISNT. B | 8,9 | Logical test of non-equivalence of identifiers | ||
C = A .EOR. B | Element-wise exclusive OR operation |
Notes
- For matrices, cij = aij × bij; for matrix multiplication see *+
- Zero is treated as FALSE as non-zero as TRUE. Logical TRUE and FALSE results are set to 1.0 and 0.0 respectively
- If either ai or bi is missing-value, the result is set to missing
- If one of ai or bi is missing-value, the result is set to the non-missing value; if both are missing, the result is missing
- Both operands A and B must be text; the result is a variate
- Operands must be matrices, symmetric matrices, or diagonal matrices of conformable dimensions
- Operands may be text or numerical
- Operator with scalar result
- Operands may be of different sizes