Skip to content

Instantly share code, notes, and snippets.

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