How can I optimize this code?

조회 수: 13 (최근 30일)
Igor Arkhandeev
Igor Arkhandeev 2021년 2월 4일
Good day to all! I have a snippet of code that is called very often. Since it is described through for loops, it is too slow. Are there any techniques to improve this part?
j = 1;
k = 1;
for l1 = 0:a
for m1 = -l1:l1
l2 = abs(m1);
if(l2 <= b)
for l2 = abs(m1):b
n = l2 * (l2 + 1) + m1 + 1;
d(j) = d(j) + G(k) * t(n);
k = k + 1;
end
else
k = k + 1;
end
if (l2 <= c)
k = k + c - l2;
end
j = j + 1;
end
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Thermodynamics & Statistical Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by