Probability And Statistics Utils for Python
These are just some classes I wrote to do problems like Dr Ecco's Omniheurist Corner in python
They are implemented in C with a python front-end, they are a good 10+ times faster than python-native implementations
It currently has objects that implement
- Permutations
- Combinations
- Cartesian product
- Priority Queue
Update Sep 1, 2005: The project is not dead, it just still works with modern versions of python and isn't going
to grow any new features. Thanks to everyone
that has dropped me an email over the years. I almost never check the email address listed in the README anymore (web ads)
but I do hang out on comp.lang.python so feel free to ask any questions there or of me directly at jackdied@jackdied.com
The latest tarball is probstat_0.912.tgz
Also check out the project summary page for news and other stuff
Changes
0.912 (Oct 11, 2002)
- Admin : Welcome John Hunter! [JDH now with full sourceforge access(TM), this release is largely due to his contributions]
- Combinations that have large input lists (>70 items) now work properly, previously if it wasn't in the size cache it would fail
- similar fix for Permutations
- tests in the test/ directory for both
0.911 (Sep 13, 2002)
- iterator over slices of permutations/combinations ignored the ending argument
0.910 (Sep 7, 2002)
- objects can still be used as iterators, but ob.next() is gone
- slices! p = probstat.Permutation(range(1,5), sub_p = p[3:5]
- len! print 'len of permute is ', len(p)
- Algorithms! we now use standard public domain algos, largely from gsl
- Priority Queue added
- ComboPermute is dead, you can now call permute with a choose argument, eg p = probstat.Permutation(range(1,5), 3)
0.901 (Aug 11, 2002)
- returned objects can be used as iterators (ob.next() still works)
- fixed typo so module init function matches module name
example usage
import probstat
li = [1,2,3,4]
for (item) in probstat.Permutation(li):
print item
for (item) in probstat.Combination(li, 3):
print item
for (item) in probstat.Cartesian([range(4), ['A', 'B']]):
print item
p = probstat.PQueue()
p.push((1, 'mary'))
p.push((3, 'bill'))
p.push((2, 'joe'))
will p.pop() in the order 'bill' 'joe' 'mary' [optional args set the default starting size and reverse prioriy]
CVS
The 0.910 flushes all the good stuff in CVS, in the future I plan on slapping a python frontend to the
GPL'd tree library (libavl) but that might be be a seperate project.
eratta
Checkout the writeup of my Bot for the 2002 Internation Conference on Functional Programming Contest. It isn't going to win (note to aspirants: 3 days is not enough time, form a team) but it is a nice mix of Python & C. I wrote the priority queue for that competition before adding it to CVS here.
This project is hosted by sourceforge, click on their adds and stuff
(for google, written by jack diederich [jackdied])
(for people, if you would like to email me, check the README)
Last modified: Thu Oct 11 13:09:11 EDT 2002