[Numpy-discussion] ANN: SfePy 2013.4

2013-11-22 Thread Robert Cimrman
I am pleased to announce release 2013.4 of SfePy. Description --- SfePy (simple finite elements in Python) is a software for solving systems of coupled partial differential equations by the finite element method. The code is based on NumPy and SciPy packages. It is distributed under the ne

[Numpy-discussion] (no subject)

2013-11-22 Thread Matthew Brett
Hi, I'm sorry if I missed something obvious - but is there a vectorized way to look for None in an array? In [3]: a = np.array([1, 1]) In [4]: a == object() Out[4]: array([False, False], dtype=bool) In [6]: a == None Out[6]: False (same for object arrays), Thanks a lot, Matthew _

Re: [Numpy-discussion] Silencing NumPy output

2013-11-22 Thread Frédéric Bastien
I didn't forgot this, but I got side tracked. Here is the Theano code I would like to try to use to replace os.system: https://github.com/Theano/Theano/blob/master/theano/misc/windows.py But I won't be able to try this before next week. Fred On Fri, Nov 15, 2013 at 5:49 PM, David Cournapeau wr

Re: [Numpy-discussion] (no subject)

2013-11-22 Thread Warren Weckesser
On Fri, Nov 22, 2013 at 4:23 PM, Matthew Brett wrote: > Hi, > > I'm sorry if I missed something obvious - but is there a vectorized > way to look for None in an array? > > In [3]: a = np.array([1, 1]) > > In [4]: a == object() > Out[4]: array([False, False], dtype=bool) > > In [6]: a == None > Out

Re: [Numpy-discussion] (no subject)

2013-11-22 Thread Robert Kern
On Fri, Nov 22, 2013 at 9:23 PM, Matthew Brett wrote: > > Hi, > > I'm sorry if I missed something obvious - but is there a vectorized > way to look for None in an array? > > In [3]: a = np.array([1, 1]) > > In [4]: a == object() > Out[4]: array([False, False], dtype=bool) > > In [6]: a == None > O

[Numpy-discussion] numpy.i and INPLACE_ARRAY1[ANY]

2013-11-22 Thread Kaspar Emanuel
Hey, I am trying to improve the Lilv Python bindings to include numpy.i to allow for creation and verification of audio test buffers using NumPy. I am just trying to get *something* working at the moment so I am tring to wrap a test function. static inline vo

Re: [Numpy-discussion] [EXTERNAL] numpy.i and INPLACE_ARRAY1[ANY]

2013-11-22 Thread Bill Spotz
Kaspar, Yes, in order for numpy.i typemaps to work, you need to provide dimensions. How is lilv_test(float*) supposed to know how large the float array is? Is it actually a method where the class knows the size? In cases where dimensions are not passed through the argument list, you have two

Re: [Numpy-discussion] [EXTERNAL] numpy.i and INPLACE_ARRAY1[ANY]

2013-11-22 Thread Kaspar Emanuel
Hi Bill, thanks for your response. So the function I am actually trying to wrap is: static inline void lilv_instance_connect_port(LilvInstance* instance, uint32_t port_index, void* data_location) It just passes on the pointer to

Re: [Numpy-discussion] [EXTERNAL] numpy.i and INPLACE_ARRAY1[ANY]

2013-11-22 Thread Bill Spotz
I think you are getting close. Application of the typemap simply requires %apply (float* INPLACE_ARRAY1, int DIM1) {(float* data_location, int unused)} rather than the entire argument list. Be sure you understand the use case. The (data_location, unused) pair is going to be provided by a

Re: [Numpy-discussion] [EXTERNAL] numpy.i and INPLACE_ARRAY1[ANY]

2013-11-22 Thread Kaspar Emanuel
Cool! That seems to have worked. Many thanks. So I didn't need my own typemap for this at all as it will already ignore the rest of the arguments? What I still don't understand is that there seems to be a typemap for INPLACE_ARRAY1[ANY] without any DIM1. How come I can't apply that? > Be sure yo

Re: [Numpy-discussion] [EXTERNAL] numpy.i and INPLACE_ARRAY1[ANY]

2013-11-22 Thread Bill Spotz
Yes, typemaps are checked against individual arguments or contiguous groups of arguments, not necessarily the entire argument list. I believe the argument would have to be "float data_location[]", signifying a null-terminated array, rather than float*, for the INPLACE_ARRAY1[ANY] to work. On No

Re: [Numpy-discussion] [EXTERNAL] numpy.i and INPLACE_ARRAY1[ANY]

2013-11-22 Thread Kaspar Emanuel
OK yeah, I tested with float data_location[] but then it expects and array of length 0, (shape [0] it says). With float data_location[64] I can use 64 size array but this isn't very useful in this instance. I will try and make a typemap for just (float* INPLACE_ARRAY) without a DIM1 as that's proba

Re: [Numpy-discussion] [EXTERNAL] numpy.i and INPLACE_ARRAY1[ANY]

2013-11-22 Thread Kaspar Emanuel
Here is the typemap for anyone with a similar problem: /* Typemap suite for (DATA_TYPE* INPLACE_ARRAY1) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* INPLACE_ARRAY1) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),