Add generalized repmat function as repeat

This pull request provides a function called `repeat` that generalizes both R's `rep` function and Matlab `repmat` function. It allows the user to repeat the inner entries of a tensor as many times as desired and to also repeat outer slices of the tensor as many times as desired.

The major question I have is where the function `fld1` should be placed: if it's not generally useful, I can hide it more.