circshift function speed up
9 次查看(过去 30 天)
显示 更早的评论
Hello, I'm trying to optimize my code. I'm using circshift function in my code. I was wondering whether there is a way to speed up the loop which is using circshift cause according to the profiler most of the time spent on running the code is spent by circshift. Either by changing the circshift or some other solutions. I have also tried to do normal indexing rather than using circshift but it's taking more time. Here is my code:
for i = 1:BitLength
d(i) = xor(initialState(2),initialState(1));
initialState = circshift(initialState,[0,1]);
initialState(1) = d(i);
end
I tried the following code but it didn't help:
for i = 1:BitLength
d(i) = xor(initialState(2),initialState(1));
initialState =initialState ([end 1:end-1]);
initialState(1) = d(i);
end
Thanks.
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!