- Timestamp:
- 12/31/12 11:35:48 (3 years ago)
- Location:
- branches/decorate
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/decorate/test_wrapper.py
r628 r629 136 136 discrete_squared.samples([1.0, 7.0]) 137 137 assert discrete_squared(5.6) == 7.0**2 138 discrete_squared.index([0, -1]) 139 assert all(discrete_squared(asarray([0, 3, 6])) == asarray([1.0, 3.0, 7.0])**2) 138 140 139 141 -
branches/decorate/wrapper.py
r628 r629 147 147 samples[0] = alist 148 148 149 def _index(alist=None): 150 index[0] = alist 151 149 152 #XXX: refactor to use argnear_factory(samples) 150 153 def _argnear(xi): … … 175 178 else: 176 179 mask = zeros(xp.size, dtype=bool) 177 try: mask[sorted(index[0] )] = True180 try: mask[sorted(index[0], key=abs)] = True 178 181 except IndexError: pass 179 182 xp = xtype(choose(mask, (x,xp))) 180 183 return f(xp, *args, **kwds) 181 184 func.samples = _points 185 func.index = _index 182 186 return func 183 187 return dec
Note: See TracChangeset
for help on using the changeset viewer.