[Numpy-discussion] numarray C api examples
jmiller at stsci.edu
Sun Mar 28 14:15:01 EST 2004
On Sun, 2004-03-28 at 10:54, Faheem Mitha wrote:
> On Sat, 27 Mar 2004, Todd Miller wrote:
> > On Sat, 2004-03-27 at 12:35, Faheem Mitha wrote:
> > > The README in numarray-0.9/Examples refers to the non-existent file
> > > setup.py (at least in that directory). There are other files called
> > > setup.py elsewhere in the tarball, but they don't look like they are
> > > supposed to compile the examples.
> > >
> > > What am I missing?
> > Nothing. Those are dead comments in the README (they didn't survive the
> > "numarray re-packaging"). There is now a single setup.py for all
> > numarray packages in the root numarray directory.
> Ok. In that case changing the README would be a good idea in order to
> avoid confusion.
> > To install the examples, just install numarray. The examples are then
> > found in the package numarray.examples.convolve.
> Ok. I see the examples are in the Debian package
I don't use debian anymore so I'm not sure what goes on there. I'm glad
some of the debian guys are making numarray available.
> > If you want to write your own extension, my advice is to stick with
> > the numpy compatible interfaces. A close second is the numarray
> > "high level" interface.
> I see. You mean use
> #include "arrayobject.h"
Exactly. Using the numpy compatible API also keeps you close to Numeric
in case small array performance ever becomes an issue for you and you
decide you want to switch back to Numeric. It might also let others who
are using Numeric use your extensions even if you choose to use numarray
> BTW, the high level API example in convolve uses
> #include "libnumarray.h"
> even though the documentation refers to
> #include "numarray.h"
Thanks for the info. Obviously this evolved over time and the docs
> Which of these should be used?
When in doubt, go with what the example code is doing (in the source
distribution), so libnumarray.h. If you see something questionable,
> Actually, it might be an idea to state
> explicitly in 12.3-12.6 which header files should be use. Possibly
> include them in the example code itself.
There is working example code in the source distribution. At one point,
the example code in the manual was working as well; that's where it came
> I'm considering just using the Numeric C API on the assumption that is
> will be easier to use (since I am a beginner). Is this assumption
I think they're both fairly easy, but the Numeric API as the advantage
of backward compatibility.
> Thanks for all the help.
Thanks for all the feedback.
Todd Miller <jmiller at stsci.edu>
More information about the NumPy-Discussion