From 056a264e3445674172d5dc44a89d28a1c1891312 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Thu, 10 Aug 2006 21:07:31 +0000 Subject: Finished up numpy.numarray.alter_code1 --- numpy/numarray/functions.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'numpy/numarray/functions.py') diff --git a/numpy/numarray/functions.py b/numpy/numarray/functions.py index 73f3f80c9..c990fe7e9 100644 --- a/numpy/numarray/functions.py +++ b/numpy/numarray/functions.py @@ -33,7 +33,8 @@ __all__ += ['vdot', 'dot', 'matrixmultiply', 'ravel', 'indices', 'repeat', 'reshape', 'resize', 'round', 'searchsorted', 'shape', 'size', 'sometrue', 'sort', 'swapaxes', 'take', 'tcode', 'tname', 'tensormultiply', 'trace', 'transpose', - 'types', 'value', 'cumsum', 'cumproduct', 'nonzero' + 'types', 'value', 'cumsum', 'cumproduct', 'nonzero', 'newobj', + 'togglebyteorder' ] import copy, copy_reg, types @@ -444,3 +445,11 @@ def argmax(x, axis=-1): def argmin(x, axis=-1): return N.argmin(x, axis) +def newobj(self, type): + if type is None: + return N.empty_like(self) + else: + return N.empty(self.shape, type) + +def togglebyteorder(self): + self.dtype=self.dtype.newbyteorder() -- cgit v1.2.1