
146 Appendix A6 OxGauss Language Reference
./ dot-division operator. The same applies for dot-multiplication, but note that 2.0*m2
and 2.0.*m2 give the same result.
A6.8.6 Additive expressions
The additive operators + and - are dot-operators, conforming to Table A6.3. They
respectively return the sum and the difference of the operands, which must both have
arithmetic type. Matrices must be conformant in both dimensions, and the operator is
applied element by element. For example:
decl m1 = <1,2; 2,1>, m2 = <2,3; 3,2>;
r = 2 - m2; // <0,-1; -1,0>
r = m1 - m2; // <-1,-1; -1,-1>
A6.8.7 Modulo expressions
The module operators % is a dot-operators, conforming to Table A6.3. It returns the
integer remainder remainder when the first operand is divided by the second. Matrices
must be conformant in both dimensions, and the operator is applied element by element.
Non-integer values are rounded to the nearest integer before applying the operator.
A6.8.8 Concatenation expressions
left operator right result
int/double ~ int/double matrix 1 × 2
int/double ~ matrix m × n matrix m × (1 + n)
matrix m × n ~ int/double matrix m × (n +1)
matrix m × n ~ matrix p × q matrix max(m, p) × (n + q)
int/double | int/double matrix 2 × 1
int/double | matrix m × n matrix (1 + m) × n
matrix m × n | int/double matrix (m +1)× n
matrix m × n | matrix p × q matrix (m + p)×max(n, q)
int ~| string string
string ~| int string
string ~| string string
array ~| array array
array ~| any basic type array
Horizontal concatenation is denoted by ~ while | is denoted by vertical concatena-
tion.
If both operands have arithmetic type, the concatenation operators are used to create
a larger matrix out of the operands. If both operands are scalar the result is a row vector
(for ~) or a column vector (for |). If one operand is scalar, and the other a matrix, an
Komentarze do niniejszej Instrukcji