function flip(m, axis) {
  m = NdArray.new(m);
  var indexer = ones(m.ndim).tolist();
  var cleanaxis = axis;
  while (cleanaxis < 0) {
    cleanaxis += m.ndim;
  }
  if (indexer[cleanaxis] === undefined) {
    throw new errors.ValueError('axis=' + axis + 'invalid for the ' + m.ndim + '-dimensional input array');
  }
  indexer[cleanaxis] = -1;
  return m.step.apply(m, indexer);
}
Reverse the order of elements in an array along the given axis.
The shape of the array is preserved, but the elements are reordered.
New in version 0.15.0.
@param {Array|NdArray} m Input array.
@param {number} axis Axis in array, which entries are reversed.
@return {NdArray} A view of `m` with the entries of axis reversed.  Since a view is returned, this operation is done in constant time.