From: Walter Roberson on
Bruno Luong wrote:
> Walter Roberson <roberson(a)hushmail.com> wrote in message

>> As the matrix of new imaginary values is being constructed, the new
>> values could be tested; set a "non-zero found" flag as a non-zero is
>> found. If any of the new values were non-zero then there is no desire
>> to delete the imaginary area; if no non-zero values were found in the
>> new values, then the _rest_ of the values could be tested, stopping if
>> a non-zero was found.

> In order to know which contains zeros which are the rest, there should
> be somehow a logical array to stores this information, possibly
> compressed in byte or even bit for each element

Not necessary, as Matlab knows the indices that were stored into, and thus
implicitly knows which indices were _not_ stored into. The worst-case scenario
would be logical indexing, but Matlab already has to scan the indices for that
situation.

I do not know that anything like this is done, just mentioning that there is a
nearly-free optimization available on some architectures.