08-10-2005 02:37 AM
08-10-2005 04:48 AM
08-10-2005 05:19 AM
Thank you for your program!
I found another solution... attachement!
Best regards,
P.F.
08-10-2005 07:45 AM
08-10-2005 08:33 AM
08-10-2005 12:17 PM
@PETER_AUT wrote:
I found another solution... attachement!
One little comment on your last version: You should not wire the array size to the loop, because the actual number of iterations will be determined by the shortest autoindexing array anyway. (If you would make X a few elements short, it would only iterate for the number of elements in the x array).
If any loop input is autoindexing, wiring N is only useful if you need to make the total iteration number less than any of the autoindexing array sizes. 😉
Your solution is fine for small to medium sized arrays. If you are dealing with huge arrays and are pressed for memory and performance, you should allocate a full sized array at the beginning of the loop (or even re-use the input arrays). Inside the loop you would index and replace elements, read at index [i] but replace at a different index (i2) that does not increment if a value is skipped (index i2 maintained in a shift register).
At the end of the loop, trim the extra tail using reshape array with a length determined from the final i2 value. 🙂
Might be a nice exercise for you to implement this! 😉
08-11-2005 03:07 AM
08-11-2005 11:00 AM - edited 08-11-2005 11:00 AM
@Soroush wrote:
A question about memory performance:Will a new copy of an array be created in the memory when we delete an element from that array?If this is true, none of these solutions are good enough.
Message Edited by altenbach on 08-11-2005 09:08 AM
08-11-2005 04:23 PM