[Numpy-discussion] End of Holidays small comments

Edward C. Jones edcjones at erols.com
Wed Jan 1 20:42:05 CST 2003


node35.html:

     >>> print x.type(), x.real.type()
     D d

should be

     >>> print x.type(), x.real.type()
     numarray type: Complex64 numarray type: Float64

------------------------------------------------

Why use both NUM_C_ARRAY and C_ARRAY?

------------------------------------------------

in  _ndarraymodule.c:

         {"_byteoffset",
          (getter)_ndarray_byteoffset_get,
          (setter)_ndarray_byteoffset_set,
          "shortest seperation between elements in bytes"},
         {"_bytestride",
          (getter)_ndarray_bytestride_get,
          (setter)_ndarray_bytestride_set,
          "shortest seperation between elements in bytes"},

One of the comments is wrong. Also "separation".

------------------------------------------------

libnumarraymodule.c:

     /* Create an empty array. */
     static PyArrayObject *
     NA_Empty(int ndim, int *shape, NumarrayType type)

node42.html:

     static PyObject* NA_Empty( NumarrayType type, int ndim, ...)

Serious documentation error.

------------------------------------------------

I think NA_New should be

     NA_New(int ndim, int* shape, NumarrayType type, void* buffer)

The current NA_New is useful only when ndim is known at code-writing time.

------------------------------------------------

node39.html:

     Note: the type parameter for a macro is one of the Numarray Numeric
     Data Types, not a NumarrayType enumeration value.

There should be an example of one of the GET/SET macros. How about

     unsigned char n;
     int i;
     ...
     n = NA_GET1(arr, UInt8, i);

------------------------------------------------

It seems that the parameters "aligned" and "writeable" are ignored in 
the source code for NA_NewAll and class NumArray.

------------------------------------------------

I would like to see an "int* strides" parameter added to NA_NewAll, so a
non-contiguous "buffer" can be used.

------------------------------------------------

I suggest NA_Copy(PyObject* arr) which is something like

static PyObject* NA_Copy(PyObject* arr)
{
     PyArrayObject* arr1 = arr;
     return NA_NewAll(arr1->nd, (long*) arr1->dimensions,
        arr1->descr->type_num, arr1->data, arr1->byteoffset,
        arr1->bytestride, arr1->byteorder, 1, 1);
}





More information about the Numpy-discussion mailing list