[Numpy-discussion] Numpy-discussion Digest, Vol 17, Issue 13

matthew yeomans matthew.yeomans@gmail....
Wed Feb 6 09:23:01 CST 2008


Is it possible to compile numpy with py2exe?

Matthew Yeomans


On 2/6/08, numpy-discussion-request@scipy.org <
numpy-discussion-request@scipy.org> wrote:
>
> Send Numpy-discussion mailing list submissions to
>        numpy-discussion@scipy.org
>
> 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
>        numpy-discussion-request@scipy.org
>
> You can reach the person managing the list at
>        numpy-discussion-owner@scipy.org
>
> 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 (humufr@yahoo.fr)
>   3. Re: [Bug] important bug in method sum (humufr@yahoo.fr)
>   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" <oliphant@enthought.com>
> Subject: Re: [Numpy-discussion] Problem accessing elements of an array
>        of dtype="O" from C
> To: Discussion of Numerical Python <numpy-discussion@scipy.org>
> Message-ID: <47A90025.4010508@enthought.com>
> 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: humufr@yahoo.fr
> Subject: [Numpy-discussion] [Bug] important bug in method sum
> To: Discussion of Numerical Python <numpy-discussion@scipy.org>
> Message-ID: <200802051458.41290.humufr@yahoo.fr>
> 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: humufr@yahoo.fr
> Subject: Re: [Numpy-discussion] [Bug] important bug in method sum
> To: Discussion of Numerical Python <numpy-discussion@scipy.org>
> Message-ID: <200802051520.09863.humufr@yahoo.fr>
> 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" <kwgoodman@gmail.com>
> Subject: Re: [Numpy-discussion] [Bug] important bug in method sum
> To: "Discussion of Numerical Python" <numpy-discussion@scipy.org>
> Message-ID:
>        <f4f93d420802052027v676c678bu6242d13191c41623@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Feb 5, 2008 11:58 AM,  <humufr@yahoo.fr> 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" <charlesr.harris@gmail.com>
> Subject: Re: [Numpy-discussion] [Bug] important bug in method sum
> To: "Discussion of Numerical Python" <numpy-discussion@scipy.org>
> Message-ID:
>        <e06186140802052103u5547d528j6f8df5a52e44d98a@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On Feb 5, 2008 9:27 PM, Keith Goodman <kwgoodman@gmail.com> wrote:
>
> > On Feb 5, 2008 11:58 AM,  <humufr@yahoo.fr> 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 <dg.numpy@thesamovar.net>
> Subject: [Numpy-discussion] Bug in numpy all() function
> To: numpy-discussion@scipy.org
> Message-ID: <loom.20080206T120807-389@post.gmane.org>
> 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" <haase@msg.ucsf.edu>
> Subject: Re: [Numpy-discussion] Numpy and C++ integration...
> To: "Discussion of Numerical Python" <numpy-discussion@scipy.org>
> Cc: Kent-Andre Mardal <kent-and@simula.no>
> Message-ID:
>        <bc657ead0802060433v50f4ddfs2ddafaa24231e2ad@mail.gmail.com>
> 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 <Glen.Mabey@swri.org> 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
> > Numpy-discussion@scipy.org
> > http://projects.scipy.org/mailman/listinfo/numpy-discussion
> >
>
>
> ------------------------------
>
> Message: 8
> Date: Wed, 06 Feb 2008 21:27:58 +0900
> From: David Cournapeau <david@ar.media.kyoto-u.ac.jp>
> Subject: [Numpy-discussion] [ANN] Blas-LAPACK superpack, 2nd alpha
> To: Discussion of Numerical Python <numpy-discussion@scipy.org>
> Message-ID: <47A9A7CE.8070201@ar.media.kyoto-u.ac.jp>
> 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 <ndbecker2@gmail.com>
> Subject: [Numpy-discussion] random enhancement
> To: numpy-discussion@scipy.org
> Message-ID: <focbk4$qlr$1@ger.gmane.org>
> 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" <Glen.Mabey@swri.org>
> Subject: Re: [Numpy-discussion] Numpy and C++ integration...
> To: Kent-Andre Mardal <kent-and@simula.no>,
>        "numpy-discussion@scipy.org" <numpy-discussion@scipy.org>
> Message-ID: <20080206143225.GA21564@bams.ccf.swri.edu>
> 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 <rmay@ou.edu>
> Subject: Re: [Numpy-discussion] Bug in numpy all() function
> To: Discussion of Numerical Python <numpy-discussion@scipy.org>
> Message-ID: <47A9CE18.3020805@ou.edu>
> 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
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
> End of Numpy-discussion Digest, Vol 17, Issue 13
> ************************************************
>



-- 
Kollox Ghal Xejn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080206/9cf2b54d/attachment-0001.html 


More information about the Numpy-discussion mailing list