[Numpy-discussion] Problems with Numexpr and discontiguous arrays

David M. Cooke cookedm at physics.mcmaster.ca
Wed Oct 4 12:44:53 CDT 2006


On Wed, 4 Oct 2006 10:23:25 -0700
Sebastian Haase <haase at msg.ucsf.edu> wrote:

> On Wednesday 04 October 2006 10:13, Tim Hochberg wrote:
> > Sebastian Haase wrote:
> > > Quick question hopefully somewhat related to this:
> > > Does numexpr fully support float32 arrays ?
> >
> > I don't recall. At one point there was a tentative plan to support
> > float32 by casting them a block at a time to float64, operating on them
> > and them casting them back. That's to limit the number of bytecodes that
> > we need to support and keep the switch statement at a manageable size.
> > However, it doesn't look like that ever got implemented, so the answer
> > is probably no.
> >
> > -tim
> 
> Does that mean its considered "impratical" to ever add native float32 
> support ?   Is the switch-statement you mention written by hand or is that 
> automatically generated ?
> -Sebastian
> 

Currently by hand. I've got a rewrite lying around that generates the C code
for it using a description in Python, but I haven't finished it yet. It
should make it much easier to add different types, along with different
methods of calculating and switching (switch vs. gcc's label pointers, for
instance).

Probably, if float32 is added, there will be two (internal) implementations:
one that uses float64 mainly, and coerces float32 to float64, and one that
does the reverse (this would be invisible to the user, of course). The same
would handle int32 and int64.

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




More information about the Numpy-discussion mailing list