Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread David Cournapeau
Matthieu Brucher wrote: Doing the wrapping in an object oriented way is difficult, and maybe not that useful. This does not prevent the API exposed to python to be OO, of course. I have some difficulties to do this in an automated way... I'm trying now to make a derived object

Re: [Numpy-discussion] Help using numPy to create a very large multi dimensional array

2007-04-19 Thread Vincent Nijs
I think it would be a great idea to have pylab.load in numpy. It also seems to be a lot faster than scipy.io. One thing that is very nice about pylab.load is that it can read-in dates. However, it can't, as far a I know, handle other non-float data. I played around with python's csv module and py

Re: [Numpy-discussion] histogram2d bug?

2007-04-19 Thread Emanuele Olivetti
David Huard wrote: > Hi Emanuele, > > The bug is due to a part of the code that shifts the last bin's > position to make sure the array's maximum value is counted in the last > bin, and not as an outlier. To do so, the code computes an approximate > precision used the shift the bin edge by amount s

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread Bill Baxter
This may be of no help at all but I see mentions of C++/Python/OO/SWIG and it triggers me to mention something I heard about recently called "PyCXX": http://cxx.sourceforge.net/ I /think/ the idea behind it is to basically make a C++ version of the Python C API. You still do all the wrapping y

Re: [Numpy-discussion] Problems building numpy and scipy on AIX

2007-04-19 Thread David M. Cooke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Christian Marquardt wrote: > Dear David, > > the svn version of numpy does indeed build cleanly on AIX. Many thanks! > > However, the wrapper problem still exists for the C++ compiler, and shows > up when compiling scipy. Now, I *assume* that SciPy i

Re: [Numpy-discussion] Building numpy on Solaris x86 with sun CC and libsunperf

2007-04-19 Thread David M. Cooke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter C. Norton wrote: > Hello all, > > I'm trying to build numpy for some of my users, and I can't seem to > get the [blas_opt] or the [lapack_opt] settings to be honored in my > site.cfg: > > $ CFLAGS="-L$STUDIODIR/lib/ -l=sunperf" CPPFLAGS='-DNO_A

Re: [Numpy-discussion] further questions: numpy on Solaris x86 with sun CC and libsunperf

2007-04-19 Thread David M. Cooke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter C. Norton wrote: > I have found a way to build numpy on solaris x86 with > libsunperf. Basically, using the static library, and removing the > compiler flag for libf77compat (I think it's deprecated and has been > removed) and furthermore symlink

Re: [Numpy-discussion] Four bugs in Numexpr and another repository

2007-04-19 Thread David M. Cooke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ivan Vilata i Balaguer wrote: > Hi all, > > Francesc and I have found four bugs in Numexpr while developing > PyTables. To spare you from the gory details, I'll point you to the > PyTables Trac instance, where bugs are commented and patches are > ava

Re: [Numpy-discussion] histogram2d bug?

2007-04-19 Thread David Huard
Hi Emanuele, The bug is due to a part of the code that shifts the last bin's position to make sure the array's maximum value is counted in the last bin, and not as an outlier. To do so, the code computes an approximate precision used the shift the bin edge by amount small compared to the array's

[Numpy-discussion] Four bugs in Numexpr and another repository

2007-04-19 Thread Ivan Vilata i Balaguer
Hi all, Francesc and I have found four bugs in Numexpr while developing PyTables. To spare you from the gory details, I'll point you to the PyTables Trac instance, where bugs are commented and patches are available which should be more or less readily applicable to mainstream Numexpr: 1. Variabl

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread Matthieu Brucher
Doing the wrapping in an object oriented way is difficult, and maybe not that useful. This does not prevent the API exposed to python to be OO, of course. I have some difficulties to do this in an automated way... I'm trying now to make a derived object from my function, without templates and

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread David Cournapeau
On 4/19/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > > > I forgot you are using C++. > > > Yes, all my code is in C++, and in fact the code I use in Python should be > object-oriented as well, that's why it is not that easy to define how I'm > going to do this... Doing the wrapping in an objec

Re: [Numpy-discussion] Problem with roots and complex coefficients

2007-04-19 Thread lorenzo bolla
updated. now it works. many thanks. L. On 4/19/07, Nils Wagner <[EMAIL PROTECTED]> wrote: lorenzo bolla wrote: > dear all, > I've some problems with numpy.roots. > take a look at the following code: > > > import numpy > > OK = numpy.roots([1, 1, 1]) > OK

[Numpy-discussion] further questions: numpy on Solaris x86 with sun CC and libsunperf

2007-04-19 Thread Peter C. Norton
I have found a way to build numpy on solaris x86 with libsunperf. Basically, using the static library, and removing the compiler flag for libf77compat (I think it's deprecated and has been removed) and furthermore symlinking liblapack.a and libblas.a to the actual libsunperf.a seems to result in a

Re: [Numpy-discussion] Help using numPy to create a very large multi dimensional array

2007-04-19 Thread Christopher Barker
Lisandro Dalcin wrote: > I am also +1 on this, but this functionality should be implemented in > C, I think. well, maybe. > I've just tested numpy.fromfile('name.txt', sep=' ') > against pylab.load('name.txt') for a 35MB text file, the number are: > > numpy.fromfile: 2.66 sec. > pylab.load: 16

Re: [Numpy-discussion] Problem with roots and complex coefficients

2007-04-19 Thread Nils Wagner
lorenzo bolla wrote: > dear all, > I've some problems with numpy.roots. > take a look at the following code: > > > import numpy > > OK = numpy.roots([1, 1, 1]) > OK = numpy.roots([1j, 1]) > KO = numpy.roots([1, 1j, 1]) > =

[Numpy-discussion] Problem with roots and complex coefficients

2007-04-19 Thread lorenzo bolla
dear all, I've some problems with numpy.roots. take a look at the following code: import numpy OK = numpy.roots([1, 1, 1]) OK = numpy.roots([1j, 1]) KO = numpy.roots([1, 1j, 1]) it fails with this error message, t

Re: [Numpy-discussion] histogram2d bug?

2007-04-19 Thread Emanuele Olivetti
An even simpler example generating the same error: import numpy x = numpy.array([0,0]) numpy.histogram2d(x,x) HTH, Emanuele Emanuele Olivetti wrote: > While using histogram2d on simple examples I got these errors: > > import numpy > x = numpy.array([0,0]) > y = numpy.array([0,1]) > numpy.histo

Re: [Numpy-discussion] Help using numPy to create a very large multi dimensional array

2007-04-19 Thread Lisandro Dalcin
On 4/19/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Nick Fotopoulos wrote: > > Devs, is there any possibility of moving/copying pylab.load to numpy? > > I don't see anything in the source that requires the rest of > > matplotlib. Among convenience functions, I think that this function > > ran

[Numpy-discussion] histogram2d bug?

2007-04-19 Thread Emanuele Olivetti
While using histogram2d on simple examples I got these errors: import numpy x = numpy.array([0,0]) y = numpy.array([0,1]) numpy.histogram2d(x,y,bins=[2,2]) - Warning: divide by zero encountered in log10 ---

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread Matthieu Brucher
I forgot you are using C++. Yes, all my code is in C++, and in fact the code I use in Python should be object-oriented as well, that's why it is not that easy to define how I'm going to do this... Using C++ with ctypes makes the wrapping more difficult, I think, specially since you are usi

[Numpy-discussion] building with MKL in windows

2007-04-19 Thread Martin Spacek
Does anyone know the right way to get numpy to build on windows using Intel's MKL for LAPACK and BLAS libraries, under MSVC7.1? I just did a whole lot of trial-and-error getting it to build. I downloaded and installed MKL for windows from http://www.intel.com/cd/software/products/asmo-na/eng/3077

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread David Cournapeau
Matthieu Brucher wrote: You should give ctypes a try, I find it much better than swig most of the time for wrapping. You can find some doc here: http://www.scipy.org/Cookbook/Ctypes2 Basically, once you get your dll/so with a function foo(double *a, int n), you

Re: [Numpy-discussion] Help using numPy to create a ve ry large multi dimensional array

2007-04-19 Thread Francesc Altet
A Dijous 19 Abril 2007 10:17, Travis Oliphant escrigué: > Nick Fotopoulos wrote: > > Devs, is there any possibility of moving/copying pylab.load to numpy? > > I don't see anything in the source that requires the rest of > > matplotlib. Among convenience functions, I think that this function > > ra

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread Matthieu Brucher
You should give ctypes a try, I find it much better than swig most of the time for wrapping. You can find some doc here: http://www.scipy.org/Cookbook/Ctypes2 Basically, once you get your dll/so with a function foo(double *a, int n), you can call it directly in numpy by passing dire

Re: [Numpy-discussion] Help using numPy to create a very large multi dimensional array

2007-04-19 Thread Travis Oliphant
Nick Fotopoulos wrote: > Devs, is there any possibility of moving/copying pylab.load to numpy? > I don't see anything in the source that requires the rest of > matplotlib. Among convenience functions, I think that this function > ranks pretty highly in convenience. > I'm supportive of this. B

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread David Cournapeau
Matthieu Brucher wrote: > Hi, > > I want to wrap some code I've done in the past with a custom array and > pass numpy arrays to it. > So I need to transform numpy arrays to my arrays at the construction > of an instance of my class, as well as each call to a method (pass by > value). Then, some

[Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread Matthieu Brucher
Hi, I want to wrap some code I've done in the past with a custom array and pass numpy arrays to it. So I need to transform numpy arrays to my arrays at the construction of an instance of my class, as well as each call to a method (pass by value). Then, some method return by value an array I have

[Numpy-discussion] C-API creating new copy of C data

2007-04-19 Thread Bill Baxter
What's the right way to make a new numpy array that's a copy of some C data? There doesn't seem to be any API like PyArray_NewFromDescr that /copies/ the void*data pointer for you. Do I have to write my own loops for this? I can do that, it just seems like it should be a library function already