PDIFF

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

The `PDIFF` positive difference 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 | `PDIFF(a,b)` | `= max( 0, a-b )`
vector | vector | vector | `PDIFF(x,y)[j]` | `= max( 0, x[j]-y[j] )`
scalar | vector | vector | `PDIFF(a,x)[j]` | `= max( 0, a-x[j] )`
vector | scalar | vector | `PDIFF(x,a)[j]` | `= max( 0, x[j]-a )`
matrix | matrix | matrix | `PDIFF(m1,m2)[i,j]` | `= max( 0, m1[i,j]-m2[i,j] )`
scalar | matrix | matrix | `PDIFF(a,m)[i,j]` | `= max( 0, a-m[i,j] )`
matrix | scalar | matrix | `PDIFF(m,a)[i,j]` | `= max( 0, m[i,j]-a )`