On Thu, Jan 26, 2012 at 6:44 AM, Pierre Haessig <pierre.haessig@crans.org> wrote:
Le 21/01/2012 20:49, Benjamin Root a écrit :
> Consider making an assignment first to the real part, and then to the
> imaginary part, the second assignment would wipe out the first (if we
> want to be consistent).
Charles case is pretty tricky and I may be confused. However, I don't
see why "the 2nd assignment should wipe out the 1st".

Indeed, considering with start with C = NA (complex)

1)  When assigning the real part of C to some value, the mask indeed
should be clear (if we assume this operation zeroes the imaginary part,
which would make sense)
2) When assigning the imaginary part to some value, C is no more masked
and there should be indeed no need to clear the real part.

I'm assuming here it is easy to access & set separately the real/im part
of a complex number. However, I pretty much unaware of complex number
memory representation...
If this separate access is not easy, then I would question the ability
to have a real/im part view on complex data.


My feeling is the the real/imag parts should each have their own mask initially copied from the complex array so that those parts could be separately manipulated but the mask on the original would not be affected. I don't think an assignment to, say, the imaginary part should have any effect on the real part and trying to mix the two would be too complicated. In the more general case of views that change the array size Mark thinks we should raise an exception, and I think that is probably the easiest way to go. Since is it possible to make an unmasked copy of an array I don't think that limits what can be done but some uncommon manipulations will be a bit more complicated.

Chuck