Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a NumPy C API function which will reset the layout flags?

I am manually modifying the shape and strides of NumPy arrays which may (or may not) invalidate the contiguity flags.

  1. Do I have to then manually check whether the strides match the values you would expect from the shape and NPY_C_CONTIGUOUS (or NPY_F_CONTIGUOUS)?
  2. Is there an API function which will do this for me and automatically clear or enable flags as is appropriate?
like image 810
Alex Rubinsteyn Avatar asked Sep 20 '13 23:09

Alex Rubinsteyn


1 Answers

I haven't tried these myself so I am not entirely clear on their use but you may try to employ:

  1. PyArray_CLEARFLAGS
  2. PyArray_ENABLEFLAGS

Found in the Numpy v1.7 Array API

like image 68
Joel Vroom Avatar answered Nov 15 '22 00:11

Joel Vroom