計算の高速化は可能か
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
5変数関数の計算を行っており、それぞれの変数が5パターンの値を持つとき、全ての組み合わは5^5通りできるかと思います。
現在for分を使用して計算を実施しているのですが、2時間程度時間がかかるため、高速計算を実施する手法が無いか探しています。
for分のコードは以下の通りです。
for i=1:5
for j=1:5
for k=1:5
for l=1:5
for m=1:5
OUTPUT(i,j,k,l,m)=subs(f,[a b c d e],[A(i,1) B(j,1) C(k,1) D(l,1) E(m,1)]);
end
end
end
end
end
2 Kommentare
Hiroyuki Hishida
am 12 Jun. 2023
Bearbeitet: Hiroyuki Hishida
am 12 Jun. 2023
いくつかあります。
まずは、単純に並列化です。 https://jp.mathworks.com/help/parallel-computing/parallel-for-loops-parfor.html 似た方法に、GPUの利用もあります。 https://jp.mathworks.com/help/parallel-computing/gpuarray.html
次はベクトル化です。 https://jp.mathworks.com/help/matlab/matlab_prog/vectorization.html
高速化に取り組まれる前に、どこで計算が遅いかを把握するのも良いと思います。
https://jp.mathworks.com/help/matlab/matlab_prog/measure-performance-of-your-program.html
いかがでしょうか。
Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!