[Numpy-discussion] Fixed-point arithemetic...any solution yet?
Charles R Harris
Thu Dec 10 09:07:53 CST 2009
On Thu, Dec 10, 2009 at 3:22 AM, Ruben Salvador <email@example.com>wrote:
> On Wed, Dec 9, 2009 at 8:26 PM, Neal Becker <firstname.lastname@example.org> wrote:
>> Ruben Salvador wrote:
>> > Hello everybody.
>> > I've seen this question arise sometimes on the list, but don't know if
>> > something has "happened" yet or not. I mean, any solution feasible to
>> > more or less right out of the box?
>> > I'm just a hardware engineer, so it would be difficult for me to create
>> > own class for this, since my knowledge of python/numpy is very limited,
>> > and, just don't have the time/knowledge to be more than a simple user of
>> > the language, not a developer.
>> > I have just come across this:
>> > http://www.dilloneng.com/documents/downloads/demodel/ but haven't used
>> > yet. I'll give it a try and see how it works and come back to the list
>> > report somehow. But, is there any "official" plans for this within the
>> > numpy developers? Is there any code around that may be used? I just need
>> > to test my code with fixed point arithmetic (I'm modelling hardware....)
>> > Thanks for the good work to all the Python/Numpy developers (and all the
>> > projects related, matplotlib and so on....) and for the possiblity of
>> > freeing from matlab!!! I'm determined to do research with as many free
>> > software design tools as possible....though this fixed-point arithmetic
>> > issue is still a chain!
>> > Regards!
>> I've done some experiments with adding a fixed-pt type to numpy, but in
>> end abandoned the effort. For now, I use integer arrays to store the
>> and then just keep variables for the #bits and position of the binary
>> For actual signal processing, I use c++ code. I have a class that is
>> on boost::constrained_value (unreleased) that gives me the behavior I want
>> from fixed point scalars.
>> NumPy-Discussion mailing list
> Well...I think I may also try this way. This FIXED_POINT_FACTOR scaling is
> what is actually done implicitly in hardware to align bit vectors. And if I
> over-dimension the bit length, I "won't need to take care" of the number of
> bits after arithmetic operations...
> I'll try and see...but, if anybody has a quicker solution....I'm actually
> in a hurry :S
> I had a look at the code I mentioned in my first email. It does the trick
> someway, but from my point of view, needs some more tweaking to be usable in
> a wider context. It only supports some operations and I just guess it will
> fail in many numpy.array routines, if data is not cast previously (maybe not
> since the actual numerical value is floating point, and the fixed point is
> an internal representation of the class)...will try and report back....
> Anyway, don't you people think we should boost this fixed-point issue in
> numpy? We should make some kind of roadmap for the implementation, I think
> it's a *MUST*.
There is certainly a whole class of engineering problems for which it would
be very useful. But things in numpy/scipy tend to get done when someone
scratches their itch and none of the current developers seem to have this
particular itch. Now, if someone comes along with a nice implementation,
voila, they become a developer and the job gets done.
Which is to say, no one is keeping the gate, contributions are welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion