08-15-2015 11:58 AM
The file includes IQ readings. These readings are converted into RMS power. various algorithms are applied to extract noise from signal. After all analysis stages a boolean array is generated (0s and 1s).
08-15-2015 11:59 AM - edited 08-15-2015 12:00 PM
Hi James.Morris.. I tested and evaluated all given solutions after employing them in the main project. I just reported what I got and what I will try to do. Thanks
08-15-2015 12:15 PM
@walidbalid wrote:
The file includes IQ readings. These readings are converted into RMS power. various algorithms are applied to extract noise from signal. After all analysis stages a boolean array is generated (0s and 1s).
So, counting the final booleans seems like a very minor part of the process. How are you doing the first parts? How efficient is that?
Where and how is the boolean(0,1) array stored? You still haven't defined your use of the term "large". can you give some numbers?
A boolean takes up very little space, properly done you can even store 8 in a single byte if memory is tight.
08-15-2015 12:32 PM - edited 08-15-2015 12:34 PM
On a side note, here's my code operating on an U8 array of zeroes and ones. It is important to operate in place and not convert large datasets to different representations.
There is still some ambiguitiy in the output, because from the two arrays we cannot tell if the original array started with false of true (except if one of the arrays is larger by one).
What else will be done with the output? Is having two arrays really the most convenient? Another possibility would be to create a single output array and set the lenght of the trues as positive counts and the Falses as negative counts. (e.g. [1,1,1,0,0,1,0,0,0,1] would give a single I32 array of [3, -2, 1, -3, 1]).
The code could also be made more efficient if you have a good guess on the size of the output array. Do you?
08-16-2015 11:56 AM
altenbach wrote:
The code could also be made more efficient if you have a good guess on the size of the output array. Do you?
The thought I was having is you could use a FOR loop to run N/2 times and stop it like you do now. I think N/2 would be the max size of each (assumes each element is a change).
08-16-2015 07:30 PM
Here is a version using a state machine driven by the boolean array. At ten million iterations of the array generator Bob Schor posted this is about 3.5 times faster than Bob's code. I did not compare it to altenbach's or crossrulz's code.
The Boolean Array Constant.vi just contains Bob's constant array for testing.
In a preliminary version I had indicators on the count arrays and the boolean array to verify that it worked correctly. That is why I had to add a bit of code to capture the last block.
Lynn
08-16-2015 07:41 PM - edited 08-16-2015 07:49 PM
Lynn, I think you need to be very careful here. Since your boolean array enters the second frame from the top (i.e. skipping the first frame), the first frame can run in parallel withe the data generation, falsifying the start time. You need to wire the boolean array across the first frame to make the result meaningful.
Once you wire the array across the first frame, Bob's code is actually faster. 😄 (And some casual testing show my code even faster :D)
08-17-2015 02:52 PM
Thanks. I had some inconsistent behavior that may be explained by that.
Lynn