Re: [Numpy-discussion] C-API: multidimensional array indexing?

2011-07-27 Thread Johann Bauer
Thanks, Mark! Problem solved. Johann ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] C-API: multidimensional array indexing?

2011-07-27 Thread Johann Bauer
Dear experts, is there a C-API function for numpy which implements Python's multidimensional indexing? Say, I have a 2d-array PyArrayObject * M; and an index int i; how do I extract the i-th row or column M[i,:] respectively M[:,i]? I am looking for a function which gives again a PyArr

[Numpy-discussion] index of the first element fulfilling a condition?

2010-08-18 Thread Johann Bauer
Hi, is there a good method to find the index of the first element in a 1D array fulfilling a condition? The following does the job >>> import numpy >>> a = numpy.array([1,5,78,3,12,4]) >>> numpy.where( a>10 )[0][0] 2 but it first compares the entire array and then selects the first index. Is