Is it possible to compile numpy with py2exe? Matthew Yeomans
On 2/6/08, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > Send Numpy-discussion mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://projects.scipy.org/mailman/listinfo/numpy-discussion > or, via email, send a message with subject or body 'help' to > [EMAIL PROTECTED] > > You can reach the person managing the list at > [EMAIL PROTECTED] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Numpy-discussion digest..." > > > Today's Topics: > > 1. Re: Problem accessing elements of an array of dtype="O" from > C (Travis E. Oliphant) > 2. [Bug] important bug in method sum ([EMAIL PROTECTED]) > 3. Re: [Bug] important bug in method sum ([EMAIL PROTECTED]) > 4. Re: [Bug] important bug in method sum (Keith Goodman) > 5. Re: [Bug] important bug in method sum (Charles R Harris) > 6. Bug in numpy all() function (Dan Goodman) > 7. Re: Numpy and C++ integration... (Sebastian Haase) > 8. [ANN] Blas-LAPACK superpack, 2nd alpha (David Cournapeau) > 9. random enhancement (Neal Becker) > 10. Re: Numpy and C++ integration... (Glen W. Mabey) > 11. Re: Bug in numpy all() function (Ryan May) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 05 Feb 2008 18:32:37 -0600 > From: "Travis E. Oliphant" <[EMAIL PROTECTED]> > Subject: Re: [Numpy-discussion] Problem accessing elements of an array > of dtype="O" from C > To: Discussion of Numerical Python <[email protected]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Chris Ball wrote: > > Hi, > > > > I'm having some trouble accessing elements in an array of dtype="O" > > from C code; I hope someone on the list could give me some advice > > (because I might be doing something stupid). > > > > I have an array of simple objects, created as follows: > > > > class CF(object): > > def __init__(self,num=0.0): > > self.num=num > > > > from numpy import array > > objs = array([[CF(0.0),CF(0.1),CF(0.2)], > > [CF(1.0),CF(1.1),CF(1.2)]],dtype=object) > > > > > > I'd like to loop through this array and access the 'num' attribute of > > each CF object - but using C. > > > > I have a C function (based on an example in the numpy book - 'Basic > > Iteration', page 312): > > > > double loop(PyObject* a_){ > > > > PyArrayIterObject *iter; > > iter = (PyArrayIterObject *)PyArray_IterNew(a_); > > > > while (iter->index < iter->size) { > > PyObject *cf = (PyObject *)(iter->dataptr); > > PyObject *num_obj = PyObject_GetAttrString(cf,"num"); > > PyArray_ITER_NEXT(iter); > > } > > return 0.0; > > } > > > The problem here is that iter->dataptr should be re-cast to a PyObject > ** because what is contained at the memory location is a *pointer* to > the PyObject. Thus, you have to de-reference iter->dataptr to get the > PyObject * that you want: > > PyObject **cf = (PyObject **)PyArray_ITER_DATA(iter); > PyObject *num_obj = PyObject_GetAttrString(*cf, "num"); > PyArray_ITER_NEXT(iter); > > should do what you want. > > -Travis O. > > > > ------------------------------ > > Message: 2 > Date: Tue, 5 Feb 2008 14:58:40 -0500 > From: [EMAIL PROTECTED] > Subject: [Numpy-discussion] [Bug] important bug in method sum > To: Discussion of Numerical Python <[email protected]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii" > > Hello, > > when doing some test I saw a very important bug in numpy (at least on the > svn > version and 1.0.3 (ubuntu package)). > > I'm using a svn version of numpy: > > In [31]: numpy.__version__ > Out[31]: '1.0.5.dev4767' > > The problem is for an array larger than 256*256 the sum is going crazy. > > In [45]: numpy.arange(256*256) > Out[45]: array([ 0, 1, 2, ..., 65533, 65534, 65535]) > > In [46]: numpy.arange(256*256).sum() > Out[46]: 2147450880 > > In [47]: numpy.arange(257*257) > Out[47]: array([ 0, 1, 2, ..., 66046, 66047, 66048]) > > In [48]: numpy.arange(257*257).sum() > Out[48]: -2113765120 > > >>> import numpy > >>> numpy.arange(256*256).sum() > 2147450880 > >>> numpy.arange(257*257).sum() > -2113765120 > >>> numpy.__version__ > '1.0.3' > > > Sorry for this bad news. > > N. > > > ps: my system is an ubuntu linux 32 > > > > ------------------------------ > > Message: 3 > Date: Tue, 5 Feb 2008 15:20:09 -0500 > From: [EMAIL PROTECTED] > Subject: Re: [Numpy-discussion] [Bug] important bug in method sum > To: Discussion of Numerical Python <[email protected]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii" > > Sorry its not really a bug. I understood why . It's an integer and I'm > doing > an overflow. Perhaps an error message can be printed or an automatic > change > (with a warning) can be done. I think that I prefer to loose the type but > keep the value correct. > > N. > > > > ------------------------------ > > Message: 4 > Date: Tue, 5 Feb 2008 20:27:46 -0800 > From: "Keith Goodman" <[EMAIL PROTECTED]> > Subject: Re: [Numpy-discussion] [Bug] important bug in method sum > To: "Discussion of Numerical Python" <[email protected]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1 > > On Feb 5, 2008 11:58 AM, <[EMAIL PROTECTED]> wrote: > > The problem is for an array larger than 256*256 the sum is going crazy. > > > > In [45]: numpy.arange(256*256) > > Out[45]: array([ 0, 1, 2, ..., 65533, 65534, 65535]) > > > > In [46]: numpy.arange(256*256).sum() > > Out[46]: 2147450880 > > > > In [47]: numpy.arange(257*257) > > Out[47]: array([ 0, 1, 2, ..., 66046, 66047, 66048]) > > > > In [48]: numpy.arange(257*257).sum() > > Out[48]: -2113765120 > > You hit the limit on how big an integer can be. You'll have to switch > to floats to do the sum: > > >> numpy.arange(257*257, dtype=numpy.float64).sum() > 2181202176.0 > > > ------------------------------ > > Message: 5 > Date: Tue, 5 Feb 2008 22:03:58 -0700 > From: "Charles R Harris" <[EMAIL PROTECTED]> > Subject: Re: [Numpy-discussion] [Bug] important bug in method sum > To: "Discussion of Numerical Python" <[email protected]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" > > On Feb 5, 2008 9:27 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > > > On Feb 5, 2008 11:58 AM, <[EMAIL PROTECTED]> wrote: > > > The problem is for an array larger than 256*256 the sum is going > crazy. > > > > > > In [45]: numpy.arange(256*256) > > > Out[45]: array([ 0, 1, 2, ..., 65533, 65534, 65535]) > > > > > > In [46]: numpy.arange(256*256).sum() > > > Out[46]: 2147450880 > > > > > > In [47]: numpy.arange(257*257) > > > Out[47]: array([ 0, 1, 2, ..., 66046, 66047, 66048]) > > > > > > In [48]: numpy.arange(257*257).sum() > > > Out[48]: -2113765120 > > > > You hit the limit on how big an integer can be. You'll have to switch > > to floats to do the sum: > > > > >> numpy.arange(257*257, dtype=numpy.float64).sum() > > 2181202176.0 > > > > Or tell numpy to use float64 for the sum: > > In [6]: a = arange(257*257) > > In [7]: a.sum(dtype=float64) > Out[7]: 2181202176.0 > > Chuck > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080205/9b51621d/attachment-0001.html > > ------------------------------ > > Message: 6 > Date: Wed, 6 Feb 2008 12:11:28 +0000 (UTC) > From: Dan Goodman <[EMAIL PROTECTED]> > Subject: [Numpy-discussion] Bug in numpy all() function > To: [email protected] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=us-ascii > > Hi all, > > I think this is a bug (I'm running Numpy 1.0.3.1): > > >>> from numpy import * > >>> def f(x): return False > > >>> all(f(x) for x in range(10)) > True > > I guess the all function doesn't know about generators? > > Dan > > > > ------------------------------ > > Message: 7 > Date: Wed, 6 Feb 2008 13:33:53 +0100 > From: "Sebastian Haase" <[EMAIL PROTECTED]> > Subject: Re: [Numpy-discussion] Numpy and C++ integration... > To: "Discussion of Numerical Python" <[email protected]> > Cc: Kent-Andre Mardal <[EMAIL PROTECTED]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1 > > How does Instant compare to scipy.weave !? > > -Sebastian Haase > > > On Feb 5, 2008 11:26 PM, Glen W. Mabey <[EMAIL PROTECTED]> wrote: > > On Tue, Feb 05, 2008 at 12:16:02PM -0600, Kent-Andre Mardal wrote: > > > We have created a small Python module Instant (www.fenics.org/instant) on > top > > > of SWIG, which makes integration of C/C++ and NumPy arrays easy in > some cases. > > > > Hello, > > > > Thank you for posting about instant. I think it looks like a great > > idea and hope to try it out soon. > > > > I noticed that you are distributing under the GPL. > > > > Would you consider releasing it under a more permissive license? > > > > Some rationale is given here: > > > > http://www.scipy.org/License_Compatibility > > > > Best Regards, > > Glen mabey > > > > _______________________________________________ > > Numpy-discussion mailing list > > [email protected] > > http://projects.scipy.org/mailman/listinfo/numpy-discussion > > > > > ------------------------------ > > Message: 8 > Date: Wed, 06 Feb 2008 21:27:58 +0900 > From: David Cournapeau <[EMAIL PROTECTED]> > Subject: [Numpy-discussion] [ANN] Blas-LAPACK superpack, 2nd alpha > To: Discussion of Numerical Python <[email protected]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hi, > > I have finished a second alpha of the BLAS/LAPACK superpack for > windows: > > > http://www.ar.media.kyoto-u.ac.jp/members/david/archives/blas-lapack-superpack.exe > (~ 9 Mb). > > Changes from first alpha > - Both SSE3 and SSE2 are supported. > - custom installation possible: you can choose to install .a, .dll, > .def and .lib for any target, atlas or netlib. > > The super pack is an installer which by default install the most > optimized blas/lapack possible to compile numpy/scipy with. > > cheers, > > David > > > ------------------------------ > > Message: 9 > Date: Wed, 06 Feb 2008 08:10:28 -0500 > From: Neal Becker <[EMAIL PROTECTED]> > Subject: [Numpy-discussion] random enhancement > To: [email protected] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=us-ascii > > One thing missing from random is a mechanism to share a single underlying > rng with other code that is not part of numpy.random. > > For example, I have code that generates distributions that expect a > mersenne > twister (the shared, underlying rng) to be passed in as a constructor > argument. > > numpy.random shares a single rng amongst it's own distributions, but I > don't > see any way to share with others. > > Ideally, I believe this is the preferred design: > > rng1 = mersenne_twister (seed = 0) > > poisson (rng1, lambda=4) > uniform (rng1, min=0, max=4) > > It would be best if numpy.random adopted this approach. Since I > understand > that's not likely, the alternative is for numpy.random to add some API > that > would allow direct access to the shared rng object. > > > > ------------------------------ > > Message: 10 > Date: Wed, 6 Feb 2008 08:32:25 -0600 > From: "Glen W. Mabey" <[EMAIL PROTECTED]> > Subject: Re: [Numpy-discussion] Numpy and C++ integration... > To: Kent-Andre Mardal <[EMAIL PROTECTED]>, > "[email protected]" <[email protected]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=us-ascii > > On Wed, Feb 06, 2008 at 03:23:43AM -0600, Kent-Andre Mardal wrote: > > No problem, it is now under BSD. OK? > > Perfect. Thank you. > > Glen > > > ------------------------------ > > Message: 11 > Date: Wed, 06 Feb 2008 09:11:20 -0600 > From: Ryan May <[EMAIL PROTECTED]> > Subject: Re: [Numpy-discussion] Bug in numpy all() function > To: Discussion of Numerical Python <[email protected]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1 > > Dan Goodman wrote: > > Hi all, > > > > I think this is a bug (I'm running Numpy 1.0.3.1): > > > >>>> from numpy import * > >>>> def f(x): return False > > > >>>> all(f(x) for x in range(10)) > > True > > > > I guess the all function doesn't know about generators? > > > > That's likely the problem. However, as of Python 2.5, there's a built > in function that will do what you want. However, you would mask that > builtin with the from numpy import *. > > Ryan > > -- > Ryan May > Graduate Research Assistant > School of Meteorology > University of Oklahoma > > > ------------------------------ > > _______________________________________________ > Numpy-discussion mailing list > [email protected] > http://projects.scipy.org/mailman/listinfo/numpy-discussion > > > End of Numpy-discussion Digest, Vol 17, Issue 13 > ************************************************ > -- Kollox Ghal Xejn
_______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
