Re: [Numpy-discussion] histogramdd memory needs

2008-02-04 Thread Lars Friedrich
Hi, 2) Is there a way to use another algorithm (at the cost of performance) that uses less memory during calculation so that I can generate bigger histograms? You could work through your array block by block. Simply fix the range and generate an histogram for each slice of 100k data

[Numpy-discussion] An idea for future numpy windows installers

2008-02-04 Thread David Cournapeau
Hi, While studying a bit nsis (an open source system to build windows installers), I realized that it would be good if we could detect the target CPU and install the right numpy accordingly. I have coded a nsis plugin to detect SSE availability (no SSE vs SSE vs SSE2 vs SS3), and including

[Numpy-discussion] numpy.asarray( iterator )

2008-02-04 Thread Sebastian Haase
Hi, Can this be changed: If I have a list L the usual N.asarray( L ) works well -- however I just discovered that N.asarray( reversed( L ) ) breaks my code Apparently reversed( L ) returns an iterator object, and N.asarray( reversed( L ) ) (called arrY in my function) results in: (Pdb) p

Re: [Numpy-discussion] [F2PY]: Allocatable Arrays

2008-02-04 Thread Lisandro Dalcin
On 2/1/08, Pearu Peterson [EMAIL PROTECTED] wrote: Sorry, I haven't been around there long time. Are you going to continue not reading the f2py list? If so, you should point everyone there to this list and close the list. Anyway, I have subscribed to the f2py list again I'll try to

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Gael Varoquaux
On Mon, Feb 04, 2008 at 11:02:29AM -0500, Vince Fulco wrote: Any trailheads for the simplest approach I find ctypes very easy to understand. See http://www.scipy.org/Cookbook/Ctypes for simple instructions. HTH, Gaël ___ Numpy-discussion mailing list

[Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Vince Fulco
Dear Numpy Experts- I find myself working with Numpy arrays and wanting to access *simple* C++ functions for time series returning the results to Numpy. As I am a relatively new user of Python/Numpy, the number of paths to use in incorporating C++ code into one's scripts is daunting. I've

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Neal Becker
I have a variety of experiments that I put in this mercurial repo: https://nbecker.dyndns.org/hg/ The primary aim of this is to reuse c++ code written to a generic container interface, with numpy. ___ Numpy-discussion mailing list

Re: [Numpy-discussion] round, fix, ceil, and floor for complex args

2008-02-04 Thread Stuart Brorson
round - works fine. ceil - throws exception: 'complex' object has no attribute 'ceil' floor - throws exception: 'complex' object has no attribute 'floor' fix - throws exception: 'complex' object has no attribute 'floor' My question: Is this a bug or a feature? It seems to me

Re: [Numpy-discussion] numpy.asarray( iterator )

2008-02-04 Thread Timothy Hochberg
On Mon, Feb 4, 2008 at 6:56 AM, Sebastian Haase [EMAIL PROTECTED] wrote: Hi, Can this be changed: If I have a list L the usual N.asarray( L ) works well -- however I just discovered that N.asarray( reversed( L ) ) breaks my code Apparently reversed( L ) returns an iterator object,

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Lou Pecora
--- Matthieu Brucher [EMAIL PROTECTED] wrote: Whatever solution you choose (Boost.Python, ...), you will have to use the Numpy C API at least a little bit. So Travis' book is a good start. As Gaël told you, you can use ctypes if you wrap manually every method with a C function and

Re: [Numpy-discussion] [F2PY]: Allocatable Arrays

2008-02-04 Thread Pearu Peterson
On Mon, February 4, 2008 4:39 pm, Lisandro Dalcin wrote: Pearu, now that f2py is part of numpy, I think it would be easier for you and also for users to post to the numpy list for f2py-related issues. What do you think? Personaly, I don't have strong opinions on this. On one hand, it would

Re: [Numpy-discussion] round, fix, ceil, and floor for complex args

2008-02-04 Thread Timothy Hochberg
On Mon, Feb 4, 2008 at 11:59 AM, Stuart Brorson [EMAIL PROTECTED] wrote: round - works fine. ceil - throws exception: 'complex' object has no attribute 'ceil' floor - throws exception: 'complex' object has no attribute 'floor' fix - throws exception: 'complex' object has no

Re: [Numpy-discussion] round, fix, ceil, and floor for complex args

2008-02-04 Thread Timothy Hochberg
On Mon, Feb 4, 2008 at 10:34 AM, Stuart Brorson [EMAIL PROTECTED] wrote: Hi -- I'm fiddling with NumPy's chopping and truncating operators: round, fix, ceil, and floor. In the case where they are passed real args, they work just fine. However, I find that when they are passed complex

[Numpy-discussion] round, fix, ceil, and floor for complex args

2008-02-04 Thread Stuart Brorson
Hi -- I'm fiddling with NumPy's chopping and truncating operators: round, fix, ceil, and floor. In the case where they are passed real args, they work just fine. However, I find that when they are passed complex args, I get the following: round - works fine. ceil - throws exception:

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Christopher Barker
Lou Pecora wrote: I would recommend using the C API I would recommend against this -- there is a lot of code to write in extensions to make sure you do reference counting, etc, and it is hard to get right. Much of it is also boiler-plate code, so it makes more sense to have that code

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Lou Pecora
Dear Mr. Fulco , This may not be exactly what you want to do, but I would recommend using the C API and then calling your C++ programs from there (where interface functions to the C++ code is compiled in the extern C {, } block. I will be doing this soon with my own project. Why? Because

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Matthieu Brucher
2008/2/4, Lou Pecora [EMAIL PROTECTED]: Dear Mr. Fulco , This may not be exactly what you want to do, but I would recommend using the C API and then calling your C++ programs from there (where interface functions to the C++ code is compiled in the extern C {, } block. I will be doing

Re: [Numpy-discussion] histogramdd memory needs

2008-02-04 Thread David Huard
2008/2/4, Lars Friedrich [EMAIL PROTECTED]: Hi, 2) Is there a way to use another algorithm (at the cost of performance) that uses less memory during calculation so that I can generate bigger histograms? You could work through your array block by block. Simply fix the range and

Re: [Numpy-discussion] round, fix, ceil, and floor for complex args

2008-02-04 Thread Travis E. Oliphant
Stuart Brorson wrote: Anyway, since NumPy is committed to (Re, Im) as the base representation of complex numbers, then it is not unreasonable to implement round, fix, and so on, by operating independently on the Re and Im parts. Or am I wrong? Sounds reasonable to me... -Travis O.

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Neal Becker
Christopher Barker wrote: Neal Becker wrote: I have a variety of experiments that I put in this mercurial repo: https://nbecker.dyndns.org/hg/ The primary aim of this is to reuse c++ code written to a generic container interface, with numpy. Neal, I'd love to hear more about this. Do

Re: [Numpy-discussion] An idea for future numpy windows installers

2008-02-04 Thread Alexander Michael
On Feb 4, 2008 5:13 AM, David Cournapeau [EMAIL PROTECTED] wrote: Hi, While studying a bit nsis (an open source system to build windows installers), I realized that it would be good if we could detect the target CPU and install the right numpy accordingly. I have coded a nsis plugin to

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Gael Varoquaux
On Mon, Feb 04, 2008 at 12:05:45PM -0800, Christopher Barker wrote: ctypes -- [...] Can it call C++ directly at all? No, but you can use 'extern C' in you cpp file, if you have controle over the file. Gaël ___ Numpy-discussion mailing list

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Gael Varoquaux
On Mon, Feb 04, 2008 at 12:49:58PM -0800, Lou Pecora wrote: So, for those looking for speed up through some external C or C++ code, I would say (trying to be fair here), try what Chris recommends below, if you want, but IMHO, none of it is trivial. If you get it to work, great. If not, you

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Bill Spotz
On Feb 4, 2008, at 1:05 PM, Christopher Barker wrote: Boost::python -- best for writing custom extensions in C++ -- also can be used for interfacing with legacy C++. There were boost array classes for numpy -- are these being maintained? There are boost array classes for Numeric, and

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Phil Austin
Bill Spotz wrote: On Feb 4, 2008, at 1:05 PM, Christopher Barker wrote: Boost::python -- best for writing custom extensions in C++ -- also can be used for interfacing with legacy C++. There were boost array classes for numpy -- are these being maintained? There are boost array

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Barry Wark
For comparison of ctypes and SWIG wrappers of a simple C++ codebase, feel free to take a look at the code for scikits.ann (http://scipy.org/scipy/scikits/wiki/AnnWrapper). The original wrapper was written using SWIG and the numpy typemaps. Rob Hetland has coded an almost-the-same API wrapper using

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Christopher Barker
Neal Becker wrote: I have a variety of experiments that I put in this mercurial repo: https://nbecker.dyndns.org/hg/ The primary aim of this is to reuse c++ code written to a generic container interface, with numpy. Neal, I'd love to hear more about this. Do you have a two paragraph

Re: [Numpy-discussion] Numpy and C++ integration...

2008-02-04 Thread Lou Pecora
--- Christopher Barker [EMAIL PROTECTED] wrote: Lou Pecora wrote: I would recommend using the C API I would recommend against this -- there is a lot of code to write in extensions to make sure you do reference counting, etc, and it is hard to get right. Well, fair enough to some