Permalink
Browse files

ENH larry.__rdiv__() is faster.

Closes #54.
  • Loading branch information...
1 parent 8eb5778 commit 1d80f97ba59dd96240c14bd6c0827bd6ba447ff9 @kwgoodman committed Mar 8, 2012
Showing with 7 additions and 8 deletions.
  1. +1 −1 RELEASE.rst
  2. +6 −7 la/deflarry.py
View
@@ -27,7 +27,7 @@ la 0.6
- Upgrade numpydoc from 0.3.1 to 0.4 to support Sphinx 1.0.1
- la.farray.ranking() and larry ranking method support `axis=None`
- Generate C code with Cython 0.15.1 instead of Cython 0.11
-- larry.astype(), larry.push() are faster
+- larry.astype(), larry.push(), larry.__rdiv__() are faster
**Breakage from la 0.5**
View
@@ -786,9 +786,9 @@ def __rdiv__(self, other):
msg += 'so I removed it. Send me your example and I will fix.'
raise RuntimeError, msg
if np.isscalar(other) or isinstance(other, np.ndarray):
- y = self.copy()
- y.x = other / y.x
- return y
+ label = self.copylabel()
+ x = other / self.x
+ return larry(x, label, validate=False)
raise TypeError, 'Input must be scalar, array, or larry.'
def __mul__(self, other):
@@ -4154,10 +4154,9 @@ def flatten(self, order='C'):
array([1, 2, 3, 4])
"""
- y = self.copy()
- y.x = y.x.flatten(order)
- y.label = flattenlabel(y.label, order)
- return y
+ label = flattenlabel(self.label, order)
+ x = self.x.flatten(order)
+ return larry(x, label, validate=False)
def unflatten(self):
"""

0 comments on commit 1d80f97

Please sign in to comment.