j*******o 发帖数: 11 | 1 最近在用MATLAB写一段仿真,发现其中的circshift这条命令非常的费时,基本上80%
的时间都花在这句上了。有没有什么其他的命令可以替代这句的,让效率更高一点?多
谢多谢 |
k**f 发帖数: 372 | 2
Maybe you can try something like
a = [a(end), a(1:end-1)];
to see if the program runs a bit faster.
If this IS the bottleneck of you simulation, you may have to write a C-mex
implementation and use data structures other than the plain c array, such as
a circular buffer.
【在 j*******o 的大作中提到】 : 最近在用MATLAB写一段仿真,发现其中的circshift这条命令非常的费时,基本上80% : 的时间都花在这句上了。有没有什么其他的命令可以替代这句的,让效率更高一点?多 : 谢多谢
|
j*******o 发帖数: 11 | 3 多谢多谢
我试试看
as
【在 k**f 的大作中提到】 : : Maybe you can try something like : a = [a(end), a(1:end-1)]; : to see if the program runs a bit faster. : If this IS the bottleneck of you simulation, you may have to write a C-mex : implementation and use data structures other than the plain c array, such as : a circular buffer.
|
z*****n 发帖数: 7639 | 4 Just a reminder:
You need to know this solution applies to only one
dimension of your matrices, and shifts only in
one direction.
circshift() can do n-dimentional shift and in both
directions.
【在 j*******o 的大作中提到】 : 多谢多谢 : 我试试看 : : as
|
j*******o 发帖数: 11 | 5 嗯,对,我目前也就是对一维的数据进行操作
再次感谢 |