Nathaniel Smith wrote:
> Numpy internally does all index/stride calculations in units of bytes,
> though, so if accessing the data array directly and using strides, the only
> reliable approach is to use intp or equivalent.
If we use PyArray_STRIDES we should use npy_intp, yes, because we are
co
Chris Barker wrote:
> 2) a numpy=based ragged array implementation might make sense as well. You
> essentially store the data in a rank-1 shaped numpy array, and provide
> custom indexing to get the "rows" out. This would allow you to have all the
> data in a single memory block available to C (o
On 2 Jul 2014 20:12, "Sturla Molden" wrote:
>
> Julian Taylor wrote:
>
> > another thing, don't use int as the index to the array, use npy_intp
> > which is large enough to also index arrays > 4GB if the platform
> > supports it.
>
> With double* a 32-bit int can index 16 GB, a 32-bit unsigned in
Julian Taylor wrote:
> another thing, don't use int as the index to the array, use npy_intp
> which is large enough to also index arrays > 4GB if the platform
> supports it.
With double* a 32-bit int can index 16 GB, a 32-bit unsigned int can index
32 GB.
With char* a 32-bit int can only inde
On 02.07.2014 13:44, Mads Ipsen wrote:
>
>
> On 02/07/14 12:46, Julian Taylor wrote:
>> On Wed, Jul 2, 2014 at 12:15 PM, Mads Ipsen wrote:
>>> Hi,
>>>
>>> If you setup an M x N array like this
>>>
>>> a = 1.0*numpy.arange(24).reshape(8,3)
>>>
>>> you can access the data from a C function like
On Wed, Jul 2, 2014 at 3:46 AM, Julian Taylor wrote:
> numpy does not directly support irregular shaped arrays (or ragged arrays).
> If you look at the result of your example you will see this:
> In [5]: b
> Out[5]: array([array([ 1., 2., 3.]), array([-2., 4.]), array([
> 5.])], dtype=object)
On 02/07/14 12:46, Julian Taylor wrote:
> On Wed, Jul 2, 2014 at 12:15 PM, Mads Ipsen wrote:
>> Hi,
>>
>> If you setup an M x N array like this
>>
>> a = 1.0*numpy.arange(24).reshape(8,3)
>>
>> you can access the data from a C function like this
>>
>> void foo(PyObject * numpy_data)
>> {
>>
On Wed, Jul 2, 2014 at 12:15 PM, Mads Ipsen wrote:
> Hi,
>
> If you setup an M x N array like this
>
> a = 1.0*numpy.arange(24).reshape(8,3)
>
> you can access the data from a C function like this
>
> void foo(PyObject * numpy_data)
> {
> // Get dimension and data pointer
> int const m =
Hi,
If you setup an M x N array like this
a = 1.0*numpy.arange(24).reshape(8,3)
you can access the data from a C function like this
void foo(PyObject * numpy_data)
{
// Get dimension and data pointer
int const m = static_cast(PyArray_DIMS(numpy_data)[0]);
int const n = static_cast