Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



a very time consumming code
Posted:
Sep 27, 2013 11:27 AM


Hi all, I am posting this portion of code if you could help me in making any improvements for its execution time.
I tried verctorising the code and using Matlab compiler but no important improvement.
codes being called millions of times (one execution needs hours with a I5 3.5GH and Ram=4GH):
***************** function [res] = binCross(a,b,cr) s=length(a); mui = rand(1,s) < cr ; % all random numbers < CR are 1, 0 otherwise mpo = mui < 0.5; res= a.*mpo + b.*mui; fx=randi(s); res(fx)=b(fx); end *****************
***************** function [res] = mutate(a,b,c,f) res=a+f*(bc); *****************
***************** function s=simplebounds(s,Lb,Ub) % Apply the lower bound ns_tmp=s; I=ns_tmp<Lb; ns_tmp(I)=Lb(I); % Apply the upper bounds J=ns_tmp>Ub; ns_tmp(J)=Ub(J); % Update this new move s=ns_tmp; end *****************
The above 'binCross' function is said to be the most complex by theprofiler.
Thank you in advance



