@classmethod<EOL><INDENT>def __distob_vectorize__(cls, f):<DEDENT>
def vf(self, *args, **kwargs):<EOL><INDENT>kwargs = kwargs.copy()<EOL>kwargs['<STR_LIT>'] = False<EOL>kwargs['<STR_LIT>'] = False<EOL>ars = [call(f, ra, *args, **kwargs) for ra in self._subarrays]<EOL>results = [convert_result(ar) for ar in ars]<EOL>if all(isinstance(r, RemoteArray) and<EOL>r.ndim == results[<NUM_LIT:0>].ndim for r in results):<EOL><INDENT>out_shapes = [ra.shape for ra in results]<EOL>new_distaxis = self._new_distaxis(out_shapes)<EOL>if new_distaxis is None:<EOL><INDENT>return results <EOL><DEDENT>if new_distaxis == results[<NUM_LIT:0>].ndim:<EOL><INDENT>results = [r.expand_dims(new_distaxis) for r in results]<EOL><DEDENT>return DistArray(results, new_distaxis)<EOL><DEDENT>elif all(isinstance(r, numbers.Number) for r in results):<EOL><INDENT>return np.array(results)<EOL><DEDENT>else:<EOL><INDENT>return results  <EOL><DEDENT><DEDENT>if hasattr(f, '<STR_LIT>'):<EOL><INDENT>vf.__name__ = '<STR_LIT:v>' + f.__name__<EOL>f_str = f.__name__ + '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>f_str = '<STR_LIT>'<EOL><DEDENT>doc = u"""<STR_LIT>""" % (f_str, f_str)<EOL>if hasattr(f, '<STR_LIT>') and f.__doc__ is not None:<EOL><INDENT>doc = doc.rstrip() + ('<STR_LIT>' + f.__doc__)<EOL><DEDENT>vf.__doc__ = doc<EOL>return vf<EOL>
Upgrades a normal function f to act on a DistArray in parallel

        Args:
          f (callable): ordinary function which expects as its first 
            argument an array (of the same shape as our subarrays)

        Returns:
          vf (callable): new function that takes a DistArray as its first
            argument. ``vf(distarray)`` will do the computation ``f(subarray)``
            on each subarray in parallel and if possible will return another 
            DistArray. (otherwise will return a list with the result for each 
            subarray).