Re: [Numpy-discussion] Conversion float64->int bugged?

2007-07-10 Thread saintmlx
I opened a new ticket for this: http://projects.scipy.org/scipy/numpy/ticket/549 Xavier Timothy Hochberg wrote: > > > On 7/9/07, *Xavier Saint-Mleux* <[EMAIL PROTECTED] > > wrote: > > Hi all, > > The conversion from a numpy scalar to a python int is not consist

Re: [Numpy-discussion] another broadcast/fancy indexing question

2007-07-10 Thread Timothy Hochberg
On 7/10/07, Mark.Miller <[EMAIL PROTECTED]> wrote: Sorry...can you clarify? I think that some of your message got cut off. -Mark Timothy Hochberg wrote: > It's because you are using arrays as indices (aka Fancy-Indexing). When > you do this everything works differently. In this case, everythi

Re: [Numpy-discussion] another broadcast/fancy indexing question

2007-07-10 Thread Mark.Miller
Sorry...can you clarify? I think that some of your message got cut off. -Mark Timothy Hochberg wrote: > It's because you are using arrays as indices (aka Fancy-Indexing). When > you do this everything works differently. In this case, everything is > being broadcast to the same shape. As I unde

[Numpy-discussion] How do I tell f2py to generate Numeric modules?

2007-07-10 Thread Ben ZX
I ran f2py. It seems to always generate NumPy modules. How do I tell f2py to generate Numeric modules? Ben ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] Problems building SVN on Windows

2007-07-10 Thread numpy-discussion
Hi, I am trying to build numpy on Windows from the current SVN (rev. 3884 I think) and I'm having some problems. I've successfully built ATLAS and LAPACK. I've installed Python 2.5.1 from the standard windows installer. I also have a fresh install of Cygwin with all mingw development tools etc. I

Re: [Numpy-discussion] another broadcast/fancy indexing question

2007-07-10 Thread Timothy Hochberg
On 7/10/07, Mark.Miller <[EMAIL PROTECTED]> wrote: Just ran across something that doesn't quite make sense to me at the moment. Here's some code: >>> numpy.__version__ '1.0.2' >>> >>> def f1(b,c): b=b.astype(int) c=c.astype(int) return b,c >>> b,c = numpy.fromfunction(

[Numpy-discussion] another broadcast/fancy indexing question

2007-07-10 Thread Mark.Miller
Just ran across something that doesn't quite make sense to me at the moment. Here's some code: >>> numpy.__version__ '1.0.2' >>> >>> def f1(b,c): b=b.astype(int) c=c.astype(int) return b,c >>> b,c = numpy.fromfunction(f1,(5,5)) >>> a=numpy.zeros((2,12,5,5),int) >>>

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Alan Isaac
On Tue, 10 Jul 2007, Timothy Hochberg wrote: > 1. > +,- are arithmetic operators and return ints not booleans > 2. > *,** are arithmetic operators on scalars and arrays and return ints as above. > 3. > &,|,^ are the logical operators and return booleans. > 4. > *,** are defined on matrices

Re: [Numpy-discussion] Conversion float64->int bugged?

2007-07-10 Thread Timothy Hochberg
On 7/9/07, Xavier Saint-Mleux <[EMAIL PROTECTED]> wrote: Hi all, The conversion from a numpy scalar to a python int is not consistent with python's native conversion (or numarray's): if the scalar is out of bounds for an int, python and numarray automatically create a long while numpy still cr

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Charles R Harris
On 7/10/07, Timothy Hochberg <[EMAIL PROTECTED]> wrote: [CHOP: lots of examples] It looks like bool_s could use some general rejiggering. Let me put forth a concrete proposal that's based on matching bool_ behaviour to that of Python's bools. There is another route that could be taken where bo

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Timothy Hochberg
[CHOP: lots of examples] It looks like bool_s could use some general rejiggering. Let me put forth a concrete proposal that's based on matching bool_ behaviour to that of Python's bools. There is another route that could be taken where bool_ and bool are completely decoupled, but I'll skip over t

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Gael Varoquaux
On Tue, Jul 10, 2007 at 11:31:35AM -0400, Alan G Isaac wrote: > Do you agree that the first (!!!) answer is a bug? > (The basis is apparently performed as follows: > integer array subtraction is first performed, and > then nonzero ints are converted to True. But this > gives the wrong answer and m

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Alan G Isaac
Hi Gael, More important is the following. On Tue, 10 Jul 2007, Alan G Isaac apparently wrote: N.array([False])-N.array([True]) > array([True], dtype=bool) N.array([False])+(-N.array([True])) > array([False], dtype=bool) > The second answer is the right one, in this context. > I

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Gael Varoquaux
On Tue, Jul 10, 2007 at 10:36:55AM -0400, Alan G Isaac wrote: > I found Gael's presentation rather puzzling for two reasons. > 1. It appears to contain a `+` vs. `*` confusion. > See http://en.wikipedia.org/wiki/Two-element_Boolean_algebra Damn it. I used math conventions, for "+" and "*" (in mat

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Alan G Isaac
On Mon, 9 Jul 2007, Timothy Hochberg apparently wrote: > x*y and x**2 are already decoupled for arrays and matrices. What if x*y was > simply defined to do a boolean matrix multiply when the arguments are > boolean matrices? > I don't care about this that much though, so I'll let it drop. So

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Alan G Isaac
I found Gael's presentation rather puzzling for two reasons. 1. It appears to contain a `+` vs. `*` confusion. See http://en.wikipedia.org/wiki/Two-element_Boolean_algebra 2. MUCH more importantly: In implementations of TWO, we interpret `-` as unary complementation (not e.g. as additive inverse

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Charles R Harris
On 7/10/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote: On Tue, Jul 10, 2007 at 02:39:28PM +0200, Sebastian Haase wrote: > When you talk about algebra - one might have to restrict one self to '|' and '&' > -- not use '+' and '-' > E.g.: > True - True = False # right !? > # but if: > True+True

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Gael Varoquaux
On Tue, Jul 10, 2007 at 02:39:28PM +0200, Sebastian Haase wrote: > When you talk about algebra - one might have to restrict one self to '|' and > '&' > -- not use '+' and '-' > E.g.: > True - True = False # right !? > # but if: > True+True = True. > # then > True+True -False = Tr

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Matthieu Brucher
When you talk about algebra - one might have to restrict one self to '|' and '&' -- not use '+' and '-' E.g.: True - True = False # right !? Not exactly because - True = + True So True - True = True + True = True You have to stay in the algebra the whole time. # but if: True+True

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Sebastian Haase
On 7/10/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > > Hi, > > > > > > > > On Mon, 9 Jul 2007, Timothy Hochberg apparently wrote: > > > > Why not simply use & and | instead of + and *? > > > > > > A couple reasons, none determinative. > > > 1. numpy is right a Python is wrong it this case > >