11-05-2013 10:33 PM
just for the sake of different solution
ofcourse valid only for positive numbers in array.
Christian, Is it fast?????
11-05-2013 11:57 PM
@Neos wrote:
Christian, Is it fast?????
Probably not, because with every iteration you compare the current value with every single value in the shift register array. N² comparisons for a size N input array. A 100x bigger array needs 10000x more comparisons!
Not tested.
11-06-2013 12:21 AM
OK Christian,
I think i got your point. ( i never thought that way ):smileysurprised:
Now i have one more idea, if i can insert 1 array subset function with index zero and length of array from lower shift register. That will only give me any array of limited elements so limited comparison but i will end up with an extra copy of array for array subset.
Am I right ?
So still not fast
11-06-2013 12:54 AM - edited 11-06-2013 01:00 AM
one more attempt
If array has zeros also then shift register comparison will start from -1.
11-06-2013 01:02 AM
11-06-2013 01:11 AM - edited 11-06-2013 01:13 AM
@altenbach wrote:
@Neos wrote:
one more attempt
This is getting better, however if the sorted input array starts with a zero, the output would be wrong. Right?
No, I edited my reply, use -1 in place on 0.
You can also save some array buffer allocations.
Where am i missing??
Also note that this idea would make things a bit simpler. 😄
Kudoed
11-06-2013 01:14 AM - edited 11-06-2013 01:15 AM
Anyway, since you are getting close, here's my benchmark I wrote earlier, compairing 4 different code versions. Mine is pretty standard code and I suspect that the openG version is similar (not checked, because I don't have it). The main technique has been discussed many times in the past (e.g. here is my post from 2005).
Attached version is in labVIEW 2013, but I also attached a LabVIEW 9 version. Do you need older?
11-06-2013 01:23 AM - edited 11-06-2013 01:26 AM
Neos wrote:
No, I edited my reply, use -1 in place on 0.
Then you will have a problem if the sorted array starts with -1. 😉
Neos wrote:
Where am i missing??
Note that you need two full sized arrays (1) the sorted array, (2) the initialized array.
If you look at my code, you will notice that I place the sorted array directly into the shift register. Since we always read from the unmodified section, there is no problem operating only on one single array.
11-06-2013 01:36 AM
I am not able to open your VI ( 2009 version ).
It say LabVIEW error load 3, could not load front panel.
11-06-2013 02:20 AM
@Neos wrote:
I am not able to open your VI ( 2009 version ).
It say LabVIEW error load 3, could not load front panel.
Well, it opens just fine back in 2013. Maybe there is a downconversion bug. What version are you using?
Here's LabVIEW 8.2 version. See if this works better.