提交 4262045b authored 作者: pl's avatar pl

Switched usage of pyArray_Empty and Zeros to PyArray_EMPTY and ZEROS and…

Switched usage of pyArray_Empty and Zeros to PyArray_EMPTY and ZEROS and adjusted documentation accordingly
上级 41b43279
...@@ -199,8 +199,8 @@ Creating NumPy ndarrays ...@@ -199,8 +199,8 @@ Creating NumPy ndarrays
The following functions allow the creation and copy of NumPy arrays : The following functions allow the creation and copy of NumPy arrays :
.. method:: PyObject* PyArray_Empty(int nd, npy_intp* dims, PyArray_Descr* .. method:: PyObject* PyArray_EMPTY(int nd, npy_intp* dims, typenum dtype,
dtype, int fortran) int fortran)
Constructs a new ndarray with the number of dimensions specified by nd, Constructs a new ndarray with the number of dimensions specified by nd,
shape specified by dims and data type specified by dtype. If fortran is shape specified by dims and data type specified by dtype. If fortran is
...@@ -208,12 +208,12 @@ The following functions allow the creation and copy of NumPy arrays : ...@@ -208,12 +208,12 @@ The following functions allow the creation and copy of NumPy arrays :
is organized in a F-contiguous layout. The array elements are not is organized in a F-contiguous layout. The array elements are not
initialized in any way. initialized in any way.
The macro PyArray_EMPTY() performs the same function as the function The function PyArray_Empty() performs the same function as the macro
PyArray_Empty() but the data type is given as a typenum instead of a PyArray_EMPTY() but the data type is given as a pointer to a
pointer to a PyArray_Descr object. PyArray_Descr object instead of a typenum.
.. method:: PyObject* PyArray_Zeros(int nd, npy_intp* dims, PyArray_Descr* .. method:: PyObject* PyArray_ZEROS(int nd, npy_intp* dims, typenum dtype,
dtype, int fortran) int fortran)
Constructs a new ndarray with the number of dimensions specified by nd, Constructs a new ndarray with the number of dimensions specified by nd,
shape specified by dims and data type specified by dtype. If fortran is shape specified by dims and data type specified by dtype. If fortran is
...@@ -221,9 +221,9 @@ The following functions allow the creation and copy of NumPy arrays : ...@@ -221,9 +221,9 @@ The following functions allow the creation and copy of NumPy arrays :
is organized in a F-contiguous layout. Every element in the array is is organized in a F-contiguous layout. Every element in the array is
initialized to 0. initialized to 0.
The macro PyArray_ZEROS() performs the same function as the function The function PyArray_Zeros() performs the same function as the macro
PyArray_Zeros() but the data type is given as a typenum instead of a PyArray_ZEROS() but the data type is given as a pointer to a
pointer to a PyArray_Descr object. PyArray_Descr object instead of a typenum.
.. method:: PyArrayObject* PyArray_GETCONTIGUOUS(PyObject* op): .. method:: PyArrayObject* PyArray_GETCONTIGUOUS(PyObject* op):
...@@ -423,9 +423,9 @@ storage with the right shape and number of dimensions. ...@@ -423,9 +423,9 @@ storage with the right shape and number of dimensions.
Decrease received reference's ref count and allocate new Decrease received reference's ref count and allocate new
output variable */ output variable */
Py_XDECREF(%(z)s); Py_XDECREF(%(z)s);
%(z)s = (PyArrayObject*)PyArray_Empty(1, %(z)s = (PyArrayObject*)PyArray_EMPTY(1,
PyArray_DIMS(%(x)s), PyArray_DIMS(%(x)s),
PyArray_DESCR(%(x)s), PyArray_TYPE(%(x)s),
0); 0);
if (!%(z)s) { if (!%(z)s) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论