- Timestamp:
- 11/14/14 17:28:54 (18 months ago)
- Location:
- mystic/_math
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/_math/grid.py
r769 r770 72 72 if ones: result = sorted(result, key=lambda v: random()) 73 73 else: result[:nfact] = sorted(result[:nfact], key=lambda v: random()) 74 from numpy import prod 75 result = [prod (result[i::dim]) for i in range(dim)]74 from numpy import product 75 result = [product(result[i::dim]) for i in range(dim)] 76 76 # if not ones, now needs a full sort to sort in the 1s 77 77 if not ones: result = sorted(result, key=lambda v: random()) -
mystic/_math/measures.py
r768 r770 503 503 zmass -- member scaling when mass = 0.0 504 504 """ 505 from numpy import prod 505 from numpy import product 506 506 weights = asarray(list(weights)) #XXX: faster to use x = array(x, copy=True) ? 507 w = float(prod (weights))507 w = float(product(weights)) 508 508 n = len(weights) 509 509 if not w: #XXX: is this the best behavior? … … 546 546 (1,4,7), (2,4,7), (3,4,7), (1,5,7), (2,5,7), (3,5,7)] 547 547 """ 548 #from numpy import prod , array, ones548 #from numpy import product, array, ones 549 549 #ndim = len(samples) 550 550 #npts = [len(s) for s in samples] 551 551 #z = [] 552 552 #for i in range(ndim): 553 # tmp = list(array([n*ones(prod (npts[:i])) for n in samples[i]]).flatten())554 # z.append( prod (npts[i+1:])*tmp )553 # tmp = list(array([n*ones(product(npts[:i])) for n in samples[i]]).flatten()) 554 # z.append( product(npts[i+1:])*tmp ) 555 555 #del tmp 556 556 #zT = [] … … 558 558 # zT.append( tuple([y.pop(0) for y in z]) ) 559 559 #return zT 560 # from numpy import prod , array, ones560 # from numpy import product, array, ones 561 561 # ndim = len(samples) 562 562 # npts = [len(s) for s in samples] 563 # z = ones((ndim, prod (npts))) # z.T of what's needed563 # z = ones((ndim, product(npts))) # z.T of what's needed 564 564 # for i in range(ndim): 565 # tmp = list(array([n*ones(prod (npts[:i])) for n in samples[i]]).flatten())566 # z[i] = prod (npts[i+1:])*tmp565 # tmp = list(array([n*ones(product(npts[:i])) for n in samples[i]]).flatten()) 566 # z[i] = product(npts[i+1:])*tmp 567 567 # return [tuple(i) for i in z.T] 568 568 ndim = len(samples) … … 594 594 [[1,2,3], [4,5], [6,7]] 595 595 """ 596 # from numpy import prod , array596 # from numpy import product, array 597 597 # ndim = len(npts) 598 598 # z = [] 599 599 # for i in range(ndim): 600 # tmp = array(samples[:int(len(samples)/prod (npts[i+1:]))]).T[i]601 # z.append( list(tmp[::int(prod (npts[:i]))]) )600 # tmp = array(samples[:int(len(samples)/product(npts[i+1:]))]).T[i] 601 # z.append( list(tmp[::int(product(npts[:i]))]) ) 602 602 # return z 603 603 _samples = []
Note: See TracChangeset
for help on using the changeset viewer.