11.5. Numpy C-APIΒΆ
NumPy provides a C-API to enable users to extend the system and get access to the array object for use in other routines. The best way to truly understand the C-API is to read the source code. If you are unfamiliar with (C) source code, however, this can be a daunting experience at first. Be assured that the task becomes easier with practice, and you may be surprised at how simple the C-code can be to understand. Even if you don’t think you can write C-code from scratch, it is much easier to understand and modify already-written source code then create it de novo.
Python extensions are especially straightforward to understand because they all have a very similar structure. Admittedly, NumPy is not a trivial extension to Python, and may take a little more snooping to grasp. This is especially true because of the code-generation techniques, which simplify maintenance of very similar code, but can make the code a little less readable to beginners. Still, with a little persistence, the code can be opened to your understanding. It is my hope, that this guide to the C-API can assist in the process of becoming familiar with the compiled-level work that can be done with NumPy in order to squeeze that last bit of necessary speed out of your code.
- 11.5.1. Python Types and C-Structures
- 11.5.2. System configuration
- 11.5.3. Data Type API
- 11.5.4. Array API
- 11.5.4.1. Array structure and data access
- 11.5.4.2. Creating arrays
- 11.5.4.3. Dealing with types
- 11.5.4.4. Array flags
- 11.5.4.5. Array method alternative API
- 11.5.4.6. Functions
- 11.5.4.7. Auxiliary Data With Object Semantics
- 11.5.4.8. Array Iterators
- 11.5.4.9. Broadcasting (multi-iterators)
- 11.5.4.10. Neighborhood iterator
- 11.5.4.11. Array Scalars
- 11.5.4.12. Data-type descriptors
- 11.5.4.13. Conversion Utilities
- 11.5.4.14. Miscellaneous
- 11.5.5. Array Iterator API
- 11.5.6. UFunc API
- 11.5.7. Generalized Universal Function API
- 11.5.8. Numpy core libraries
- 11.5.9. C API Deprecations