Provide the implementation of the outer product of vectors u and v, masked to non-zero values of the matrix mask.