Let us take an example of PSO implementation by Syed Ali Mirjalili, respected researcher in optimization field.
% Main loop
for t = 1 : maxIter
% Calcualte the objective value
for k = 1 : noP
currentX = Swarm.Particles(k).X;
position_history(k , t , : ) = currentX;
Swarm.Particles(k).O = fobj(currentX);
average_objective(t) = average_objective(t) + Swarm.Particles(k).O;
Here, why we use dot operator? Like this I face other issues.
In brief, what are your suggestions about optimization algorithm(s) implemetation.?