[SciPy-dev] Flop counter for numpy/scipy

David M. Cooke cookedm at physics.mcmaster.ca
Thu Aug 3 16:21:49 CDT 2006


On Thu, 03 Aug 2006 17:43:55 +0200
"Nils Wagner" <nwagner at iam.uni-stuttgart.de> wrote:

> Hi all,
> 
> Is there a way to count flops in numpy/scipy ?
> I mean, how can I compare two algorithms ?

Easiest is to just time them. Realistically, that's what you're worried
about, not how many flops they take. If you need the O(.) behaviour, plot it
for several sizes of inputs, and see what it fits to.

If you really want to count flops, you've got two options: make a number type
that keeps track of operations done on it, then use object arrays, or make an
array class that does the same; you'll likely need __getitem__ to return a
number type like in the first case.

Or something like that. You'll run into trouble if you can't pass arbitrary
arrays, or object arrays.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca


More information about the Scipy-dev mailing list