Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-08 Thread Timothy Hochberg
On Nov 8, 2007 3:28 AM, Sebastian Haase <[EMAIL PROTECTED]> wrote: > On Nov 7, 2007 6:46 PM, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > > > > > > > > > > On Nov 7, 2007 10:35 AM, Sebastian Haase <[EMAIL PROTECTED]> wrote: > > > > > > On Nov 7, 2007 5:23 PM, Matthieu Brucher <[EMAIL PROTECTED]>

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-08 Thread Sebastian Haase
On Nov 7, 2007 6:46 PM, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > > > > > On Nov 7, 2007 10:35 AM, Sebastian Haase <[EMAIL PROTECTED]> wrote: > > > > On Nov 7, 2007 5:23 PM, Matthieu Brucher <[EMAIL PROTECTED]> > wrote: > > > > > > > I don't understand. I'm thinking of most math functions in t

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Timothy Hochberg
On Nov 7, 2007 10:35 AM, Sebastian Haase <[EMAIL PROTECTED]> wrote: > On Nov 7, 2007 5:23 PM, Matthieu Brucher <[EMAIL PROTECTED]> > wrote: > > > > > I don't understand. I'm thinking of most math functions in the > > > C-library. In C a boolean is just an integer of 0 or 1 (quasi, by > > > defini

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Sebastian Haase
On Nov 7, 2007 5:23 PM, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > > > I don't understand. I'm thinking of most math functions in the > > C-library. In C a boolean is just an integer of 0 or 1 (quasi, by > > definition). > > > > Could you explain what you mean ? > > > > In C++, bool is a new ty

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Matthieu Brucher
> > I don't understand. I'm thinking of most math functions in the > C-library. In C a boolean is just an integer of 0 or 1 (quasi, by > definition). > > Could you explain what you mean ? > In C++, bool is a new type that has two values, true and false. If you add true and true, it is still true,

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Sebastian Haase
On Nov 7, 2007 4:45 PM, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > Unfortunately, operations on boolean are not the same as operations on > integers, so you can't replace one with another. I don't understand. I'm thinking of most math functions in the C-library. In C a boolean is just an integ

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Matthieu Brucher
Unfortunately, operations on boolean are not the same as operations on integers, so you can't replace one with another. Matthieu 2007/11/7, Sebastian Haase <[EMAIL PROTECTED]>: > > O.K., so sizeof(bool) is 1. > But I already have a function instantiation for uint8. > > The problem is that without

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Sebastian Haase
O.K., so sizeof(bool) is 1. But I already have a function instantiation for uint8. The problem is that without doing "some magic" the compiler (?, or numpy ?) would never allow to use anything but a "dedicated" bool-typed function for bool. Even though the CPU treats bool exactly like an integer o

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Matthieu Brucher
Hi, No, a bool is not an int32. Try just sizeof(bool) to be sure (on my box, it's one). Besides, if you use a std::vector of bool, be aware of the fact that it is not like the other vectors. Matthieu 2007/11/7, Sebastian Haase <[EMAIL PROTECTED]>: > > Hi, > I have a templated function written in

[Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Sebastian Haase
Hi, I have a templated function written in C++. My SWIG typemap instantiates this for many argument array types (such as unit8, int16, uint16, int32, float32,float64,...) All works well, except when feeding in a boolean array as in seb.mmms(a>6) I get this error: NotImplementedError: No matching fu