- Timestamp:
- 12/31/12 10:14:52 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/decorate/wrapper.py
r626 r627 41 41 42 42 43 from numpy import asarray, any, inf, vectorize, choose 43 from numpy import asarray, any, inf, vectorize, choose, zeros, ones 44 44 def bounded(min=None, max=None): 45 45 """impose an infinite barrier box constraint on a function … … 168 168 xp = near(x, samples[0][arglo], samples[0][arghi]) 169 169 # create a choice array from given indices 170 mask = xp*False #FIXME: better ways to do this 171 try: mask[sorted(index)] = True #FIXME: better ways to do this 172 except IndexError: pass 170 #FIXME: better ways to do the following 171 if index is None: 172 mask = ones(xp.size, dtype=bool) 173 else: 174 mask = zeros(xp.size, dtype=bool) 175 try: mask[sorted(index)] = True 176 except IndexError: pass 173 177 xp = xtype(choose(mask, (x,xp))) 174 178 return f(xp, *args, **kwds)
Note: See TracChangeset
for help on using the changeset viewer.