Last active
February 20, 2018 09:53
-
-
Save junichiro/7d0dfd2a0e40e034e561092cf0478fba to your computer and use it in GitHub Desktop.
機械学習を1ヵ月で実践レベルにする #6 (Octave 実践編) ref: https://qiita.com/junichiro/items/7972b1b6ad3d087fbde0
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
a = [1, 2, 3] | |
b = [2, 3, 4] | |
ans = 0 | |
for i, v in enumerate(a): | |
ans = ans + a[i] * b[i] | |
print(ans) |
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
a = [1;2;3] | |
b = [2;3;4] | |
ans = 0 | |
for j = 1:length(a) | |
ans = ans + a(j) * b(j); | |
end | |
display(ans) |
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
a = [1;2;3] | |
b = [2;3;4] | |
ans = a' * b | |
display(ans) |
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
a` * b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment