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
scalarscalarscalar  MOD(a,b) = a-b*INT(a/b)
vectorvectorvector  MOD(x,y)[j] = x[j]-y[j]*INT(x[j]/y[j])
scalarvectorvector  MOD(a,x)[j] = a-x[j]*INT(a/x[j])
vectorscalarvector  MOD(x,a)[j] = x[j]-a*INT(x[j]/a)
matrixmatrixmatrix  MOD(m1,m2)[i,j] = m1[i,j]-m2[i,j]*INT(m1[i,j]/m2[i,j])
scalarmatrixmatrix  MOD(a,m)[i,j] = a-m[i,j]*INT(a/m[i,j])
matrixscalarmatrix  MOD(m,a)[i,j] = m[i,j]-a*INT(m[i,j]/a)