Created
October 29, 2012 02:20
-
-
Save shoya140/3971059 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAX = 100; | |
x = rand(MAX, MAX); | |
s = ones(MAX, 1) * sum(x); | |
%良くないアルゴリズム | |
%for i = 1:MAX | |
% for j = 1:MAX | |
% ans(j, i) = x(j, i)/s(j, i); | |
% end | |
%end | |
%ans | |
%良いアルゴリズム(要素ごとの演算処理) | |
ans = x ./ s | |
%TESTCODE 全要素が1ならばOK | |
%sum(ans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment