Message105657
Isn't it amazing how fast one can make incorrect code? ;-)
Here is a fixed version of my partial_product3, but now it is no faster than partial_product.
def partial_product3(j, i):
a = [l << 1 | 1 for l in range(j, i + 1)]
n = len(a)
while 1:
if n == 1:
return a[0]
half = n//2
for k in range(0,half):
a[k] = a[k*2] * a[k*2+1]
if n & 1:
a[half] = a[n-1]
n = half + 1
else:
n = half |
|
Date |
User |
Action |
Args |
2010-05-13 21:13:35 | stutzbach | set | recipients:
+ stutzbach, rhettinger, mark.dickinson, belopolsky, draghuram |
2010-05-13 21:13:35 | stutzbach | set | messageid: <1273785215.48.0.563755383228.issue8692@psf.upfronthosting.co.za> |
2010-05-13 21:13:33 | stutzbach | link | issue8692 messages |
2010-05-13 21:13:33 | stutzbach | create | |
|