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

1

6

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?
Aviary answered 20/9, 2013 at 23:23 Comment(1)
+1: Good question...I'd like to know toLamed
L
1

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

Lamed answered 24/9, 2013 at 14:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.