[Numpy-discussion] Assigning complex value to real array

Pauli Virtanen pav@iki...
Thu Oct 7 16:14:51 CDT 2010


to, 2010-10-07 kello 15:38 -0400, Andrew P. Mullhaupt kirjoitti:
[clip]
> On 10/7/2010 1:01 PM, Pauli Virtanen wrote:
> > to, 2010-10-07 kello 12:08 -0400, Andrew P. Mullhaupt kirjoitti:
> > [clip]
> > But to implement this, you'd have to rewrite large parts of Numpy since
> > the separated storage of re/im conflicts with its memory model.
> 
> You wouldn't want to rewrite any of Numpy, just add a new class.

I believe you didn't really think about this. Because of the memory
model mismatch, you will need to rewrite all arithmetic operations,
special functions, and any operations that select, choose, sort, etc.
parts of arrays.

Even if retaining the current memory model, guaranteeing implicit
casting requires rewriting any C code that might write to an
user-provided array. Moreover, in this case implicit casting will break
memory view semantics, since reallocation becomes necessary.

It still looks like significant rewriting to me. 

> What does log(int(2)) return? I guess someone 
> "needed" that one. But not log(int(-2)). Well, who needs physics and 
> electrical engineering.

Now I understand why no physicist or engineer uses FORTRAN.

> No, there is a big need to get the feature in sooner rather than
> later.  By having this behavior, Python is filtering out a lot of
> potential users.

Having strict data types is not the only place where Numpy behaves
differently from Matlab. So it is hard to believe, without any
substantive facts having been presented so far, that strict data types
would be *the* crucial issue for N >> 1 users.


Best regards,
Pauli Virtanen




More information about the NumPy-Discussion mailing list