Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
それ NArray でできるよ
Search
tmaeda
February 08, 2014
Technology
11k
18
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
それ NArray でできるよ
tmaeda
February 08, 2014
More Decks by tmaeda
See All by tmaeda
アクターモデルの話
tmaedax
7
1.8k
Jupyter(主にnotebook)のご紹介
tmaedax
1
1.4k
VoiceText Web APIでのGolang利用事例のご紹介
tmaedax
2
2.3k
AngularJSのご紹介
tmaedax
12
6.6k
静的型付き関数型言語のススメ
tmaedax
3
1.6k
Other Decks in Technology
See All in Technology
beyond jj: config & tools ecosystem
indirect
0
5.6k
Minecraft JavaのMODをSwiftで作る
1mash0
0
190
え、こんなに早く改修できるの?──新人エンジニアとスクラムマスターの2人が語る、AI×アジャイル開発の現場
ysasago
2
580
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
2.1k
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
9
4.7k
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
350
AI coding 整合正規方法
philipz
0
410
Railsのように考える: See through the Master
snoozer05
PRO
4
1.2k
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
200
C#未経験の僕がAIに読めるコードを書かせるまで
maguroalternative
0
150
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
530
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
360
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Optimizing for Happiness
mojombo
378
71k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
580
Product Roadmaps are Hard
iamctodd
55
13k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
Paper Plane
katiecoart
PRO
4
53k
Writing Fast Ruby
sferik
630
63k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
600
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.8k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
500
Transcript
ͦΕ/"SSBZͰ Ͱ͖ΔΑ 札幌中央区RRuubbyy会議0011 22001144年22月88日 @@ttmmaaeeddaa
!UNBFEB
!UNBFEB w3VCZྺ͏ʹͳΓ·͢ɻ
!UNBFEB w3VCZྺ͏ʹͳΓ·͢ɻ (C)Ωϟϓςϯཌྷ
!UNBFEB w3VCZྺ͏ʹͳΓ·͢ɻ (C)Ωϟϓςϯཌྷ
!UNBFEB wͦͷੲຊΛॻ͍ͨΓ͠·ͨ͠ɻ
!UNBFEB wաڈճ΄Ͳࡳຈ3VCZձٞͰ3BJMTͷ͓Λ͞ ͖ͤͯ·ͨ͠ɻ
!UNBFEB w ג ͑ʹ͠ςοΫͰͲͬΓ3VCZͰࣄ͕Ͱ͖ ͯͤͰ͢ɻ
ࠓޚࣾͷϏδωε Ͱ͝׆༻͍͚ͨͩΔ /"SSBZ ͷ͝ఏҊͰ͢ɻ
/"SSBZʁ ॳࣖ ໊લ͙Β͍ฉ͍ͨࣄ͋Δ ͬͨ͜ͱ͋Δ Α͘͏
/"SSBZ wాதণ͞Μ࡞ͷ3VCZ༻ଟ࣍ݩྻܭࢉ ϥΠϒϥϦɻ wओʹେྔͷܭࢉΛߴʹॲཧ͢Δ͜ͱΛ తʹ࡞ΒΕͨͷɻ http://magazine.rubyist.net/?0006-RLR
ͲΕ͙Β͍͍͔ʁ ྻཁૉ ඵ ྻʹ͔Β·ͰͷཚΛ֨ೲ͠ɺͦͷ߹ܭɺฏۉɺࢄɺ࠷େɺ࠷খΛٻΊΔͷʹ͔͔ͬͨ߹ܭඵ 3VCZ /"SSBZ .BD#PPL"JS*OUFM$PSFJ()[
ͲΕ͙Β͍͍͔ʁ ྻཁૉ ඵ ྻʹ͔Β·ͰͷཚΛ֨ೲ͠ɺͦͷ߹ܭɺฏۉɺࢄɺ࠷େɺ࠷খΛٻΊΔͷʹ͔͔ͬͨ߹ܭඵ 3VCZ /"SSBZ .BD#PPL"JS*OUFM$PSFJ()[ ഒ ߴ
ͲΕ͙Β͍͍͔ʁ ྻཁૉ ඵ ྻʹ͔Β·ͰͷཚΛ֨ೲ͠ɺͦͷ߹ܭɺฏۉɺࢄɺ࠷େɺ࠷খΛٻΊΔͷʹ͔͔ͬͨ߹ܭඵ 3VCZ /"SSBZ .BD#PPL"JS*OUFM$PSFJ()[ ഒ ߴ Ͱɾ͢ɾ͕ʜ
ඵ ඵ ඵ
ສ݅Ҏ ্ͷܭࢉΛΑ ͘ඞཁͱ͢Δ ਓʙʁ ඵ ඵ ඵ
ͰɺͲΜͳ ʹখͯ͘͞ ͍͍ͷͰɺද ܭࢉΛΑ͘ඞ ཁͱ͢Δ ਓʙʁ
ͱ͍͏Θ͚Ͱɺࠓ /"SSBZͷ໘ΑΓ ɺදܭࢉػೳʹ ண͓ͨ͠Λ͠·͢ɻ
ྫ͑ɺ͜Μͳද
ྫ͑ɺ͜Μͳද ߦશମͷ߹ܭʁ
&YDFMͩͱʁ
3VCZඪ४ͷ"SSBZͩͱʁ a = [[1,2,3], [4,5,6], [7,8,9]] => [[1, 2, 3],
[4, 5, 6], [7, 8, 9]] a[1].inject(:+) => 15
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1] => NArray.int(3): [ 4, 5, 6 ] na[true, 1].sum => 15
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1] => NArray.int(3): [ 4, 5, 6 ] na[true, 1].sum => 15 JOUܕͷ ºͷ࣍ݩ ྻΛ༻ҙͯ͠
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1] => NArray.int(3): [ 4, 5, 6 ] na[true, 1].sum => 15 ࢝·ΓͰɺ ͣͭ૿Ճ͢ΔͰ ຒΊΔ
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1] => NArray.int(3): [ 4, 5, 6 ] na[true, 1].sum => 15 ศ্ٓɺԣ࣠ΛY࣠ɺ ॎ࣠ΛZ࣠ͱݺͼ·͢ Αɻ Y Z
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1] => NArray.int(3): [ 4, 5, 6 ] na[true, 1].sum => 15 Y࣠શ෦ɺ Z࣠൪ɺ Λऔಘ ศ্ٓɺԣ࣠ΛY࣠ɺ ॎ࣠ΛZ࣠ͱݺͼ·͢ Αɻ Y Z
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1] => NArray.int(3): [ 4, 5, 6 ] na[true, 1].sum => 15 ͦΕΛ߹ܭ
·ͱΊΔͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1].sum => 15
/"SSBZͷಛ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1].sum => 15 ͪΌΜͱºͷܗ Ͱදࣔͯ͘͠ΕΔ
/"SSBZͷಛ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, 1].sum => 15 ૢ࡞શͯNBQɻ ࣗͰNBQ JOKFDUͳͲΛॻ ͘ඞཁͳ͍ɻ
ൺͯΈ·͠ΐ͏ x࣠ํͷ߹ܭ Array a[1].inject(:+) NArray na[true, 1].sum
ൺͯΈ·͠ΐ͏ x࣠ํͷ߹ܭ Array a[1].inject(:+) NArray na[true, 1].sum /"SSBZͷํ͕ײత Ͱ͕͢ɺ "SSBZͰ
·ͩڐͤΔϨϕϧ
Z࣠ํͷ߹ܭ ͬͯΈ·͠ΐ͏
ྫ͑ɺ͜Μͳද "ྻશମͷ߹ܭʁ
&YDFMͩͱʁ
3VCZඪ४ͷ"SSBZͩͱʁ a = [[1,2,3], [4,5,6], [7,8,9]] => [[1, 2, 3],
[4, 5, 6], [7, 8, 9]] a.map{|row| row[0]}.inject(:+) => 12
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[0, true] => NArray.int(3): [ 1, 4, 7 ] na[0, true].sum => 12
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[0, true] => NArray.int(3): [ 1, 4, 7 ] na[0, true].sum => 12 Y࣠൪ɺ Z࣠શ෦ Λऔಘ Y Z
/"SSBZͩͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[0, true] => NArray.int(3): [ 1, 4, 7 ] na[0, true].sum => 12 ͦΕΛ߹ܭ
·ͱΊΔͱʁ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[0, true].sum => 12
ൺͯΈ·͠ΐ͏ x࣠ํͷ߹ܭ y࣠ํͷ߹ܭ Array a[1].inject(:+) a.map{|row| row[0]}. inject(:+) NArray na[true,
1].sum na[0, true].sum
ൺͯΈ·͠ΐ͏ x࣠ํͷ߹ܭ y࣠ํͷ߹ܭ Array a[1].inject(:+) a.map{|row| row[0]}. inject(:+) NArray na[true,
1].sum na[0, true].sum "SSBZͩͱɺྻͷ߹ܭͷͱ͖ͷίʔυͱશ͘ର শੑ͕ͳ্͍ʹɺগͯ͘͠Կ͍ͬͯΔͷ͔ Θ͔Γʹ͍͘Ͱ͢Ͷ
͜͜·Ͱͷ·ͱΊ w/"SSBZͰදΛදͱͯ͠ѻ͑·͢ɻ wૢ࡞શͯNBQJOKFDUʹ૬͢ΔͷͰɺࣗ ͰNBQJOKFDUΛॻ͘ඞཁ͕͋Γ·ͤΜɻ
ͬͱෳࡶͳྫ ͬͯΈ·͠ΐ͏
ूܭද࡞͍ͬͯͩ͘͞Ҋ݅
ूܭද࡞͍ͬͯͩ͘͞Ҋ݅ Α͋͘Γ·͢ΑͶʁ
ͷখܭΛٻΊΔʹʁ
3VCZඪ४ͷ"SSBZͰߟ͑ Δͷ͏ࢭΊ·ͯ͠ʜ
/"SSBZͰ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, [0,1]] => NArray.int(3,2): [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] na[true, [0,1]].sum(1) => NArray.int(3): [ 5, 7, 9 ]
/"SSBZͰ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, [0,1]] => NArray.int(3,2): [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] na[true, [0,1]].sum(1) => NArray.int(3): [ 5, 7, 9 ] Y࣠શ෦ɺ Z࣠൪ͱ൪ Λऔಘ Y Z
/"SSBZͰ na = NArray.int(3,3).indgen!(1,1) => NArray.int(3,3): [ [ 1, 2,
3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] na[true, [0,1]] => NArray.int(3,2): [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] na[true, [0,1]].sum(1) => NArray.int(3): [ 5, 7, 9 ] ͦΕΛZ࣠ํʹ ߹ܭ
ͪͳΈʹ na[true, [0,1]] => NArray.int(3,2): [ [ 1, 2, 3
], [ 4, 5, 6 ] ] na[true, [0,1]].sum(0) na[true, [0,1]].sum(1) na[true, [0,1]].sum => NArray.int(2): [ 6, 15 ] => NArray.int(3): [ 5, 7, 9 ] => 21
ͪͳΈʹ na[true, [0,1]] => NArray.int(3,2): [ [ 1, 2, 3
], [ 4, 5, 6 ] ] na[true, [0,1]].sum(0) na[true, [0,1]].sum(1) na[true, [0,1]].sum => NArray.int(2): [ 6, 15 ] => NArray.int(3): [ 5, 7, 9 ] => 21 TVN ͩͱɺ Y࣠ํʹ߹ܭ͞Εͯ
ͪͳΈʹ na[true, [0,1]] => NArray.int(3,2): [ [ 1, 2, 3
], [ 4, 5, 6 ] ] na[true, [0,1]].sum(0) na[true, [0,1]].sum(1) na[true, [0,1]].sum => NArray.int(2): [ 6, 15 ] => NArray.int(3): [ 5, 7, 9 ] => 21 TVN ͩͱɺ Z࣠ํʹ߹ܭ͞Εͯ
ͪͳΈʹ na[true, [0,1]] => NArray.int(3,2): [ [ 1, 2, 3
], [ 4, 5, 6 ] ] na[true, [0,1]].sum(0) na[true, [0,1]].sum(1) na[true, [0,1]].sum => NArray.int(2): [ 6, 15 ] => NArray.int(3): [ 5, 7, 9 ] => 21 TVNͩͱɺ શํʹ ߹ܭ͞Ε·͢
ͭ·Γɺ͜ͷลશ෦ɺTVN ͰٻΊΒΕΔΘ͚Ͱ͢ʂ TVN TVN TVN
͜Μͳߟ͑ํ ͋Γ·͢ɻ
͍ͭ͘ͷ࣠Ͱྨ͞Εͨ දͰ͠ΐ͏͔ʁ
͍ͭ͘ͷ࣠Ͱྨ͞Εͨ දͰ͠ΐ͏͔ʁ ੈͷ࣠
͍ͭ͘ͷ࣠Ͱྨ͞Εͨ දͰ͠ΐ͏͔ʁ ੑผͷ࣠
͍ͭ͘ͷ࣠Ͱྨ͞Εͨ දͰ͠ΐ͏͔ʁ ళͷ࣠
ͱ͍͏͜ͱɺ࣍ݩ ͷදͰ࣋ͭํ͕ࣗવ ͳͷͰʁ
͜Μͳײ͡ "ళ #ళ $ళ
உ ঁ ººͷදʢۭؒ
na = NArray.int(3, 2, 2).indgen!(1, 1) => NArray.int(3,2,2): [ [
[ 1, 2, 3 ], [ 4, 5, 6 ] ], [ [ 7, 8, 9 ], [ 10, 11, 12 ] ] ] /"SSBZͰදݱ͢Δͱʁ
na[0, 0, 0] => 1 na[0, 1, 0] => 4
na[0, 0, 1] => 7 Λऔಘͯ͠Έ·͠ΐ͏ "ళ உ "ళ ঁ "ళ உ
ͷશ෦ʁ na[true, true, 0] => NArray.int(3,2): [ [ 1, 2,
3 ], [ 4, 5, 6 ] ] na[true, true, 0].sum => 21 ళશ෦ ੑผશ෦
உੑͷશ෦ʁ na[true, 0, true] => NArray.int(3,2): [ [ 1, 2,
3 ], [ 7, 8, 9 ] ] na[true, 0, true].sum => 30 ళશ෦ ੈશ෦ உੑ
ͬͱศརʹʂ w/"SSBZԿ࣍ݩͷσʔλͰѻ͑Δ w͍͍ͪͪͱྻͷΠϯσοΫεΛ಄Ͱߟ͑ͯ ରԠ͚ͮΔͷ໘ͳͷͰɺͦ͜Λਓʹ༏͍͠ײ ͡ͷϥούʔΛඃͤͯ͋͛Δͱɺҙͷͷ࣠ ͰσʔλΛཧͰ͖Δശ͕Ͱ͖͕͋Γ·͢ɻ
cube = Cube.new([ {key: :mise, values: ["Aళ", "Bళ", "Cళ"]}, {key:
:sedai, values: ["10","20"]}, {key: :sei, values:["உ","ঁ"]} ]) # ళA, 20, ঁʹ20Λઃఆ cube.set( { mise: "Aళ", sedai: "20", sei: "ঁ" }, 20) # ళA, 20, ঁͷΛऔಘ cube.get( { mise: "Aళ", sedai: "20", sei: "ঁ" }) => 20 # 10ͷΛऔಘ cube.get( { sedai: "10"} ) => NArray.int(3,2): [ [ 1, 2, 3 ], [ 7, 8, 9 ] ]
·ͱΊ w/"SSBZҙͷͷ࣠ͷσʔλΛࣗ༝ʹѻ͑ ·͢ɻ w/"SSBZͦͷσʔλۭؒͷதͷ͖ͳॴͷ σʔλʹॊೈʹΞΫηεͰ͖·͢ɻ w&YDFM͙Β͍ΧδϡΞϧʹ/"SSBZΛ͍·͠ ΐ͏ʂ
ࢀߟ wϚχϡΞϧ IUUQOBSSBZSVCZGPSHFPSHJOEFYIUNMKB w3VCZٯҾ͖Ϩγϐ Ϩγϐ wOVNQZؔͷࢿྉ
ͥͻޚࣾͷϏδωε ͝׆༻͍ͩ͘͞ɻ