Filter löschen
Filter löschen

Converting dependent for loops to parfor

2 Ansichten (letzte 30 Tage)
mila9905
mila9905 am 25 Dez. 2017
Beantwortet: mila9905 am 9 Feb. 2018
Roughly, the code looks like this:
for t=1:NumberOfSteps
F=zeros(1,N)
for i=1:N-1
for j=i+1:N
rij=r(:,i)-r(:,j)
Fij=... %some function of rij
F(:,i)=F(:,i)+Fij
F(:,j)=F(:,j)-Fij
end
end
end
Any idea how to convert this to parfor?
Many thanks!!

Antworten (2)

MBD4FUN
MBD4FUN am 25 Dez. 2017

mila9905
mila9905 am 9 Feb. 2018
Actually, I have looked through the options for parallelized computing, and all the requirements loops need to fullfil in order to convert it to parfor, but still I can't solve this(I'm a complete beginner in this). The eror I get says that the variable F cannot be classified. Maybe the problem is that I have multiple assignments for variable F?

Kategorien

Mehr zu Loops and Conditional Statements 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!

Translated by