How do I speed up 4 nested loops?

2 ビュー (過去 30 日間)
sherine
sherine 2016 年 1 月 21 日
編集済み: Stephen23 2016 年 1 月 21 日
I need to test different variables for thresholds and parameters to get the optimal ones for an algorithm... so the pseudo code is
for threshold1=1:10
for threshold2=1:10
for parameter1=1:10
for parameter2=1:10
Apply algorithm using the 4 values and evaluate
Compare to previous best results, if better then override
end
end
end
end
  1 件のコメント
Stephen23
Stephen23 2016 年 1 月 21 日
編集済み: Stephen23 2016 年 1 月 21 日
Write vectorized code instead of using loops.

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2016 年 1 月 21 日
There is no magic trick to accelerate the loops. The point which can be improved is hidden in the text "Apply algorithm". Can this algorithm be vectorized, such it replies a vector of values for the input parameter2 = 1:10.
Using a local optimization method would be smart, if the reply of teh "algorithm" is smooth and has one local minimum only.

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by