07-03-2017 02:07 AM
07-03-2017 02:23 AM - edited 07-03-2017 02:23 AM
@User002_Automation wrote:
Now with another way of doing
Same problem. You are still resizing the array (now increasing in size) with every iteration of the loop. The array output size is the same as the input size, so all can be done in-place using fixed size arrays. (also autoindexing output arrays know the final size before the loop starts and it can be allocated at once).
Not good. Still way too complicated.
Bzzzt! try again ! 😄
07-03-2017 02:27 AM
Good Morning,
Thanks for your replies, I really appreciate it. I tried to use an alternative way to get a 1D reverse Array. But I get only the last element of the input array. Comments are really appreciable....
07-03-2017 02:30 AM - edited 07-03-2017 02:47 AM
@Avral wrote:
But I get only the last element of the input array.
If you leave the index terminal of "replace array subset" unwired, you'll only ever replace the same first element (index =0). Try to figure out where you need to replace the current element. i.e. calculate the index needed to replace the last element in the first iteration, the second to last at the second iteration, etc. and the first element at the last iteration. All clear?
ALSO: Index array with the index wired to the iteration terminal is typically identical (the notable exceptions don't apply here) to an autoindexing input tunnel, so you can simplify that too. And since you now have an autoindexing tunnel, you no longer need to wire N because the number of iterations needed is known. You also don't need to initialize a new array, you can just branch from the input array to the shift register. Since every single element will be overwritten inside the loop, it does not matter if it contains mixed values at the beginning. 😄
07-03-2017 03:12 AM
thanks for your reply, I figured it out...
07-03-2017 03:22 AM - edited 07-03-2017 03:27 AM
@Avral wrote:
thanks for your reply, I figured it out...
Congratulations! 😄
Here are a few efficient ways I came up with earlier. There are always several good ways (and also several bad ways, see above 🐵 to do something.

The last version does it "in-place" and in half the number of iterations (or less). I doubt it makes a big difference. Some can even be parallelized (not recommended here). What other advantages or disadvantages do you see between the various versions?
07-03-2017 10:04 AM
thanks you very much for your helpful comments.