Harmonized expand, expandAs and repeatTensor

Like the `view` method, the subject methods now accept an optional `result` tensor. The PR includes two new unit tests : `expand` and `repeatTensor`. 

Also fixes #59.
where is this used?