About dtypes in Python and Cython

The dtypes of python and cython got messed up, so I organized them.

background

For example, float64 is used in python dtype, but float64_t is used in cython. What is the difference between them? Can I use it in the same way?

What is float64_t

First,

import numpy as np
cimport numpy as np

Then import the numpy module on the first line and simply include numpy.pxd on the next line. Looking at the cython installation folder, there is certainly numpy.pxd, and float64_t is

ctypedef double       npy_float64
ctypedef npy_float64    float64_t

Is defined as.

Conclusion

float64_t ≠ float64 and float64_t = double.

reference

https://stackoverflow.com/questions/11004659/what-is-the-difference-between-numpy-type-identifiers-and-types-within-cytho

Recommended Posts

About dtypes in Python and Cython
About __all__ in python
Think about depth-priority and width-priority searches in Python
About the difference between "==" and "is" in python
About python objects and classes
About Python variables and objects
Think about architecture in python
About Python, len () and randint ()
About Python datetime and timezone
Stack and Queue in Python
About Python and regular expressions
Unittest and CI in Python
About "for _ in range ():" in python
About Python and os operations
Python # About reference and copy
About Python sort () and reverse ()
Difference between list () and [] in Python
About installing Pwntools and Python2 series
Difference between == and is in python
Manipulate files and folders in Python
About python dict and sorted functions
Assignments and changes in Python objects
About Python pickle (cPickle) and marshal
[Python] About Executor and Future classes
About Python, from and import, as
Check and move directories in Python
Ciphertext in Python: IND-CCA2 and RSA-OAEP
Hashing data in R and Python
I learned about processes in Python
Function synthesis and application in Python
Export and output files in Python
Reverse Hiragana and Katakana in Python2.7
Reading and writing text in Python
[GUI in Python] PyQt5-Menu and Toolbar-
About _ and __
Create and read messagepacks in Python
Overlapping regular expressions in Python and Java
Differences in authenticity between Python and JavaScript
Notes using cChardet and python3-chardet in Python 3.3.1.
Modules and packages in Python are "namespaces"
Avoid nested loops in PHP and Python
Differences between Ruby and Python in scope
AM modulation and demodulation in Python Part 2
difference between statements (statements) and expressions (expressions) in Python
Eigenvalues and eigenvectors: Linear algebra in Python <7>
Implementation module "deque" in queue and Python
Line graphs and scale lines in python
Implement FIR filters in Python and C
Differences in syntax between Python and Java
Check and receive Serial port in Python (Port check)
Search and play YouTube videos in Python
Difference between @classmethod and @staticmethod in Python
Difference between append and + = in Python list
Difference between nonlocal and global in Python
Write O_SYNC file in C and Python
Dealing with "years and months" in Python
Read and write JSON files in Python
Easily graph data in shell and Python
Private methods and fields in python [encryption]
Find and check inverse matrix in Python
Linear Independence and Basis: Linear Algebra in Python <6>