|
From: Travis O. <oli...@ee...> - 2006-01-18 22:58:18
|
Fernando Perez wrote: > David M. Cooke wrote: > >> I've done a little bit of work along these lines. I have a module I >> call vector3 [*] which has 2- and 3-dimensional immutable vectors, >> using either ints or doubles. It's as fast as I could make it, while >> keeping it all written in Pyrex. I find it very convenient for >> anything vector-related. Konrad Hinsen has something similiar in the >> development version of his ScientificPython package. >> >> [*] http://arbutus.mcmaster.ca/dmc/software/vector3.html >> >> Also, I've also done some playing around with a n-dimensional vector >> type (restricted to doubles). My best attempts make it ~4-5x faster >> than numpy (and 2x faster than Numeric) for vectors of dimension 10 >> on simple ops like + and *, 2x faster than numpy for dimension 1000, >> and approaching 1x as you make the vectors larger. Indexing is about >> 3x faster than numpy, and 1.4x faster than Numeric. So that gives I >> think some idea of the maximum speed-up possible. >> >> I think the speedups mostly come from the utter lack of any >> polymorphism: it handles vectors of doubles only, and only as >> contiguous vectors (no strides). > > > This is excellent, thanks for the pointer. I can see uses for vectors > (still 1-d, no strides, etc) with more than 3 elements, and perhaps > fixed-size (no reshaping, no striding) 2-d arrays (matrices), but this > looks like a good starting point. Sandbox material? > With the array interface, these kinds of objects can play very nicely with full ndarray's as well... -Travis |