Matlab: need some help for a seemingly simple vectorization of an operation

后端 未结 3 775
孤独总比滥情好
孤独总比滥情好 2020-12-19 21:12

I would like to optimize this piece of Matlab code but so far I have failed. I have tried different combinations of repmat and sums and cumsums, but all my attempts seem to

3条回答
  •  情话喂你
    2020-12-19 21:52

    Update: here are the results for the running times for the different proposals (10^5 trials):

    So it looks like the transformation of the matrix is the most efficient intervention, and my original double-loop implementation is, amazingly, the best compared to the vectorized versions. However, in my hands (2017a) the improvement is only 16.6% compared to the original using the mean (18.2% using the median).

    Maybe there is still room for improvement?

提交回复
热议问题