MOD

Syntax: | `vout = MOD( v1, v2 )`

The `MOD` modulus function is an element by element function that requires two (2) arguments. The arguments can be scalars, vectors, matrices or tensors, but vectors, matrices and tensors cannot be mixed, and all arrays must be the same size. Scalar arguments result in a scalar. A vector argument result in a vector with the same length as the argument, and matrix (tensor) arguments result in a matrix (tensor) with the same dimensions as the arguments.

arg 1 | arg 2 | result | definition
scalar | scalar | scalar | `MOD(a,b)` | `= a-b*INT(a/b)`
vector | vector | vector | `MOD(x,y)[j]` | `= x[j]-y[j]*INT(x[j]/y[j])`
scalar | vector | vector | `MOD(a,x)[j]` | `= a-x[j]*INT(a/x[j])`
vector | scalar | vector | `MOD(x,a)[j]` | `= x[j]-a*INT(x[j]/a)`
matrix | matrix | matrix | `MOD(m1,m2)[i,j]` | `= m1[i,j]-m2[i,j]*INT(m1[i,j]/m2[i,j])`
scalar | matrix | matrix | `MOD(a,m)[i,j]` | `= a-m[i,j]*INT(a/m[i,j])`
matrix | scalar | matrix | `MOD(m,a)[i,j]` | `= m[i,j]-a*INT(m[i,j]/a)`