ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flipping the array


Since a 100x100 array  has 10000 elements, how does placing the next element at position 1100 make any sense?


I meant 1 comma 100 and not 1100.Sorry abt the confusion
0 Kudos
Message 11 of 20
(1,381 Views)
JoelabVIEW u r right.A picture is worth more than 100x100 wordsSmiley Very Happy.Please find the attachment
0 Kudos
Message 12 of 20
(1,381 Views)
Hi rpr,

have you tried corys example from message 6? You need just one for loop less - it's your turn to find out which one to omitSmiley Wink
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 20
(1,375 Views)


rpr wrote:
JoelabVIEW u r right.A picture is worth more than 100x100 wordsSmiley Very Happy.Please find the attachment

Here are two simple possibilities.

 


Message Edited by altenbach on 07-15-2008 12:35 AM
Message 14 of 20
(1,370 Views)
Thanx a ton altenbach.Just a question,I am using this to flip aan image.The image dimension is 2000x1500.Is this the best possible way altenbach.Will revert back with the exact time taken.

Thanx for the help guys

PS: I suppose altenbach wouldn't mind me using the icon he designedSmiley Wink


Message Edited by rpr on 07-15-2008 02:44 AM
0 Kudos
Message 15 of 20
(1,366 Views)
No problem with the icon. 🙂
 
Here are 4 more versions. I would code up all version and run a quick benchmark with typical data. I would guess the versions that operate "in place" are best.
 


Message Edited by altenbach on 07-15-2008 01:03 AM
Message 16 of 20
(1,357 Views)
Thanx altenbach.The time taken is 3 seconds approx.
0 Kudos
Message 17 of 20
(1,349 Views)
OK, here are some benchmarks.
 
Using the numbering of the output indicator, you want to go with #5 or #6. They are about equivalent.
 
Version #1 is > 2x slower. The two transpositions are not exactly free.
Version #2 is > 3x slower. Operating on columns is inefficient because the elements are not adjacent in memory.
Version #3 is ~1.5x slower. Pretty efficient but twice as many iterations as #5/#6.
Version #4 builds an array in a loop and is thus several orders of magnitude slower (>1000x for 1500x2000!). Definitely not recommended.
 
Here's the final version of #5, which is what I probably would use. Note that the earlier image has a slight bug, so use the following:
 
 
Please verify correct operation. This is not fully tested. 😄
 
 


Message Edited by altenbach on 07-15-2008 02:07 AM
Message 18 of 20
(1,348 Views)
OK, here's a quick benchmark version comparing some of the algorithms. (LV 8.5.1)
 
(The numberings is a bit different and I left out the "built array" version. It is too slow. :))
 
 
Message 19 of 20
(1,331 Views)
What else can i ask for thanx a lot altenbach
0 Kudos
Message 20 of 20
(1,325 Views)