06-15-2009 10:18 AM
Dear all
I have a subVI which tries to estimate "sample entropy" it works OK but it is too slow. I was wondering if you have any suggestion on my VI how I can speed it up. I attached the files here I would be grateful if you take a look.
Best regards
Afshin
Solved! Go to Solution.
06-15-2009 03:20 PM
Afshin,
I found several little things, but they probably do not make much difference. Moving calculations and controls outside loops when the inputs will not change within the loop can help. I have attached some of the changes.
I suspect that some of the array manipulations can be simplified, but I am not sure what you are trying to do. Please post a VI with some typical data saved as default. Also indicate what the function or procedure being implemented is.
How long does your VI take and how fast would you like it to be?
Lynn
06-16-2009 01:51 AM
Dear Lynn
Thank you for your attention and good advices.
I attached the main subVI with saved default values. "Repmat" is supposed to repeat the input array "Dim1" times along the first dimension and "Dim2" times along the second dimesio. It should be similar to what "repmat"in MATLAB does. Obviously "Max on Row"finds the max of each row on input matrix.
For the default input which is 1500 samples long it takes arround 2 second but I would like to have it like at least half as much.
thank you again for your attention.
BR
Afshin
06-16-2009 06:38 AM - edited 06-16-2009 06:39 AM
Hi Afshin,
Good afternoon and I hope your well today.
Thanks for the post!
I have been looking about these function from the Mathworks pages. I have created a LabVIEW example which generates this outcome in next to no time. I have asked a few of the team to take a look, and we could think of any more efficent methods or rules you could apply to simplifer the computation required i.e. if you want to repeat it x by y times then x + y alterations are required.
How large is your input array (m x n) ?
The code I have attached is in LabVIEW 8.6 and includes benchmarking - so give it ago. And I will run the same test on my machine. If you are using a different version of LabVIEW just let me know, and I'll repost the code.
What sort of machine are you running your code on?
Please let me know how this finds you and I hope it helps,
06-16-2009 06:46 AM
Hi
Thanks a lot! Actually I use LV 8.2.1 so I would be grateful to have compatible with that in my case the input is not that big I have only two channels which I estimate the sample entropy for each of them and in each channel I have about 6000 samples at each execution.
Thanks again. It is a great help.
Regards
Afshin
06-16-2009 06:55 AM
Hi Afshin,
Good Afternoon and I hope your well today.
Here is the code in LabVIEW 8.2.1. I have tested it and it works the same.
If you could test it against your code / and then tell me what test you did and the times it took on your machine. I dont mind doing the same, and see if my machine was just faster or if maybe your code is using a different method.
Let me know!& maybe consider the kudos button 🙂
06-16-2009 07:19 AM
thank you again!
I think the most time cosuming part of my VI is the nested loop which is too long although your codes are a bit of modification but still it is slow. I work on a machine with Intel (dual core) 2.1 GHz and 1 GB RAM with windows XP. Now I changed the algorithm to have a rough estimate of what I was calculating but in proper time so once again thank you.
BR
Afshin
06-16-2009 07:20 AM
I pressed the kudos button several times but I don't know why it is not working!
06-16-2009 07:35 AM
Hi Afshin,
Thanks for your prompt reply and I hope your well.
To leave kudos you must be signed in - did you check this? But then you must of been to select a solution. Maybe try another time if you wish. 😉
I think you have a large number of datapoints so a bit of time would need to be taken. Do you know how long this function takes in Matlab?
06-16-2009 07:39 AM
Hi
Yes I am logged in and I also approved the solution but still when I press it does not do anything.
BR
Afshin