numarray C api examples
![](https://secure.gravatar.com/avatar/b3308afd77cbb561a4c676aa091e55fc.jpg?s=120&d=mm&r=g)
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? Thanks, Faheem. ******************************************************************** This directories gives examples and benchmarks ot he usage of numarray. To install do ,---- | python setup.py install `---- in this directory. This will install all examples. You can test all of them by running ,---- | python testall.py `---- or go to the individual subdirectories and look at the examples more closely. ********************************************************************
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Sat, 2004-03-27 at 12:35, Faheem Mitha wrote:
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. To install the examples, just install numarray. The examples are then found in the package numarray.examples.convolve. 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. Regards, Todd -- Todd Miller <jmiller@stsci.edu>
![](https://secure.gravatar.com/avatar/b3308afd77cbb561a4c676aa091e55fc.jpg?s=120&d=mm&r=g)
On Sat, 27 Mar 2004, Todd Miller wrote:
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 python2.3-numarray-ext.
I see. You mean use #include "arrayobject.h" right? BTW, the high level API example in convolve uses #include "libnumarray.h" even though the documentation refers to #include "numarray.h" Which of these should be used? 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. 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 accurate? Thanks for all the help. Faheem.
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Sun, 2004-03-28 at 10:54, Faheem Mitha wrote:
Sure.
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.
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 yourself.
Thanks for the info. Obviously this evolved over time and the docs didn't.
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, ask.
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 from.
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. Regards, Todd
Faheem.
-- Todd Miller <jmiller@stsci.edu>
![](https://secure.gravatar.com/avatar/e4a371267d360e24c4c5001a4928175d.jpg?s=120&d=mm&r=g)
On Mar 27, 2004, at 2:49 PM, Todd Miller wrote:
Does numarray have the equivalent of PyArray_FromDimsAndData()? This function is critical for the work I'm doing on Co-Array Python (because it is essentially a distributed array module with Co-Array syntax, it must use memory allocated by C) and for using Fortran memory for Numeric or numarray arrays. Regards, Craig
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Mon, 2004-03-29 at 11:25, Craig Rasmussen wrote:
numarray's Numeric compatibility layer has that function. Because numarray uses buffer objects, numarray winds up making a copy of the data. This behavior could be changed but hasn't been yet. Regards, Todd -- Todd Miller <jmiller@stsci.edu>
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Sat, 2004-03-27 at 12:35, Faheem Mitha wrote:
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. To install the examples, just install numarray. The examples are then found in the package numarray.examples.convolve. 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. Regards, Todd -- Todd Miller <jmiller@stsci.edu>
![](https://secure.gravatar.com/avatar/b3308afd77cbb561a4c676aa091e55fc.jpg?s=120&d=mm&r=g)
On Sat, 27 Mar 2004, Todd Miller wrote:
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 python2.3-numarray-ext.
I see. You mean use #include "arrayobject.h" right? BTW, the high level API example in convolve uses #include "libnumarray.h" even though the documentation refers to #include "numarray.h" Which of these should be used? 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. 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 accurate? Thanks for all the help. Faheem.
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Sun, 2004-03-28 at 10:54, Faheem Mitha wrote:
Sure.
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.
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 yourself.
Thanks for the info. Obviously this evolved over time and the docs didn't.
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, ask.
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 from.
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. Regards, Todd
Faheem.
-- Todd Miller <jmiller@stsci.edu>
![](https://secure.gravatar.com/avatar/e4a371267d360e24c4c5001a4928175d.jpg?s=120&d=mm&r=g)
On Mar 27, 2004, at 2:49 PM, Todd Miller wrote:
Does numarray have the equivalent of PyArray_FromDimsAndData()? This function is critical for the work I'm doing on Co-Array Python (because it is essentially a distributed array module with Co-Array syntax, it must use memory allocated by C) and for using Fortran memory for Numeric or numarray arrays. Regards, Craig
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Mon, 2004-03-29 at 11:25, Craig Rasmussen wrote:
numarray's Numeric compatibility layer has that function. Because numarray uses buffer objects, numarray winds up making a copy of the data. This behavior could be changed but hasn't been yet. Regards, Todd -- Todd Miller <jmiller@stsci.edu>
participants (3)
-
Craig Rasmussen
-
Faheem Mitha
-
Todd Miller