
Ok , The same for asarray(1) .. The problem is that aa=asarray(1) is an numpy.array (right ? ) with a size 1 and a shape ( ) ! No surprising ? Claude

On Wed, Aug 27, 2008 at 12:01 PM, Claude Gouedard <cgoued@gmail.com> wrote:
Ok , The same for asarray(1) .. The problem is that aa=asarray(1) is an numpy.array (right ? ) with a size 1 and a shape ( ) ! No surprising ?
For me, this is not surprising at all :-) . Furthermore, if you try In [1]: import numpy as np In [2]: a = np.asarray(1) In [3]: a.flags Out[3]: C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False You see that this 0-dim array is WRITEABLE, this is a nice way to get something similar to an scalar with can be safely modified in-place and (pointer) passed to C/C++/Fortran. BTW, I'm using numpy 1.1.0, and the it seems 0-dim arrays are NOT Fortran contiguous... Is this OK? -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594
participants (3)
-
Claude Gouedard
-
Dag Sverre Seljebotn
-
Lisandro Dalcin