Optimize Matlab Codes

When computing the inner product of two vectors, a'*b is SIX times faster than dot(a,b). Turn on profile and try the follow script:

n = 1e3;
iter = 1e5;
a = rand(n,1);
b = rand(n,1);
for i = 1:iter
a'*b;
dot(a,b);
end

Advertisements

0 Responses to “Optimize Matlab Codes”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Categories

Blog Stats

  • 247,883 hits

%d bloggers like this: