Thanks to all for the insight. Yes, in this case I merely wanted to make all the invalid positions valid again, so removing the array was probably always the better way to go. If removed, the structure of the array doesn't matter and there's no chance of mismatching the data type and dependency. Maybe there is no other conceivable reason why anyone would want to "alter" the invalid positions array, but if the case does arise, I will understand the mechanics now.
From: [EMAIL PROTECTED] To: [email protected] Date: Tue, 30 Nov 1999 14:02:08 -0500 Subject: Re: [opendx-users] structure of invalid positions array Reply-To: [email protected] As you have figured out, the two types of arrays encode the same information in different ways. In the case of an array of bytes, a "1" means it's invalid, and a "0" means it's valid. In the case of an array of ints, it is a list of the invalid positions. If I understand you correctly, you cast the invalid positions to byte(0). This changes the invalidity of course. When you start with an array of bytes which is "dep positions", and cast it all to "byte(0)", you are saying that all the positions are "valid". When you start with an array of ints which is "ref positions", and cast it all to "byte(0)" then, ignoring the fact that modules don't like it to be byte, you are saying that position 0 (and only position 0) is invalid. And you're saying it a whole bunch of times (0, 0, 0, 0, 0) which modules may not accept, since it's not the way "ref" type invalid positions arrays are constructed. If all you are trying to do is make everything valid, then you can of course remove invalid positions as you've done. So I guess one question is why you are trying to alter the invalids? And rather than a type check, it's probably more correct that you extract the invalid positions, and check if there is a "dep" or a "ref" attribute on them. Then proceed accordingly. By the way, it is possible to convert a "ref" type to a "dep" type by running it through compute and saying "invalid(a) ? byte(1) : byte(0)". But in general this isn't necessary since either type should work without you paying attention to it. So, back to the question, why are you wanting to alter the array? _________________________________ Donna L. Gresh Visual Analysis Group IBM T.J. Watson Research Center (914) 784-5049 [EMAIL PROTECTED] "Sharon Cady" <[EMAIL PROTECTED]> on 11/30/99 01:42:17 PM Please respond to [email protected] To: [email protected] cc: Subject: [opendx-users] structure of invalid positions array Recently I ran across some data for which the invalid positions component array comes back as integer rather than the byte array that I have been used to. A "wrong type" error occurs in subsequent modules that utilize invalid positions (ShowBoundary) if, for example, the 1's are then casted to byte(0). The User's Guide explains that for a smaller number of invalid positions, in order to save memory the array is structured differently (integer indices of only the invalid positions, rather than an array of bytes with same dimensions as the data field). Is it expected then that a type-check must be made before the invalid positions array is altered ? In this particular case I bypassed the problem by removing the invalid positions rather than manipulating them, but I would like to know the philosophy behind all this. --- End of forwarded mail from [email protected]
