Created
January 3, 2013 03:29
-
-
Save mattebb/4440528 to your computer and use it in GitHub Desktop.
Numpy C-API bits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ensure array is contiguous, aligned and correct data type */ | |
array = PyArray_FROM_OTF(input_array, NPY_FLOAT32, NPY_CARRAY_RO); | |
/* reshape the input array to the correct dimensions */ | |
PyArray_Dims dims; | |
npy_intp shape[2] = {-1, attr.count}; | |
dims.len = 2; | |
dims.ptr = shape; | |
array = PyArray_Newshape((PyArrayObject *)array, &dims, NPY_CORDER); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment