diff options
| author | Miguel <m.i@gmx.at> | 2019-04-02 20:36:52 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2019-04-02 20:36:52 +0200 |
| commit | 1017a2614c1708bac638fec5108b5dc83729f760 (patch) | |
| tree | 1fb2d58fb757162fa03ccad631fbbd97f5afaaea /00_blog/00040_Haskell | |
| parent | b0f9cc1c78ddf0a9d0b6f23dc07817625dbe209c (diff) | |
some new stuff
Diffstat (limited to '00_blog/00040_Haskell')
| -rw-r--r-- | 00_blog/00040_Haskell/00010_Links-and-Literature/index.md | 3 | ||||
| -rw-r--r-- | 00_blog/00040_Haskell/00020_GHC-Notes/index.md | 30 | ||||
| -rw-r--r-- | 00_blog/00040_Haskell/00040_Convex-and-Concave-Hulls/alpha.png | bin | 0 -> 555961 bytes | |||
| -rw-r--r-- | 00_blog/00040_Haskell/00040_Convex-and-Concave-Hulls/index.md (renamed from 00_blog/00040_Haskell/00040_Graham-Scan/index.md) | 138 | ||||
| -rw-r--r-- | 00_blog/00040_Haskell/00220_Neural-Networks/index.md | 7 | ||||
| -rw-r--r-- | 00_blog/00040_Haskell/00240_FFI-Foreign-Function-Interface/index.md | 19 |
6 files changed, 59 insertions, 138 deletions
diff --git a/00_blog/00040_Haskell/00010_Links-and-Literature/index.md b/00_blog/00040_Haskell/00010_Links-and-Literature/index.md index b09733d..4ede8c0 100644 --- a/00_blog/00040_Haskell/00010_Links-and-Literature/index.md +++ b/00_blog/00040_Haskell/00010_Links-and-Literature/index.md @@ -1,10 +1,11 @@ # Haskell - Books, Links and Papers -A growing collection of external links and books concerning Haskell. +A growing collection of external links and books concerning (or tangent to) Haskell. * **Learn You a Haskell** for Great Good by Marian Lipovaca * **Real World Haskell** by Bryan O'Sullivan, Don Stewart, and John Goerzen * **Parallel and Concurrent Programming in Haskell** by Simon Marlow +* **Category Theory for Programmers** by Bartosz Milewski * **Haskell Wiki** <https://wiki.haskell.org> * **UPENN CIS 194** <https://www.seas.upenn.edu/~cis194/spring13/> * **What I Wish I Knew When Learning Haskell** by Stephen Diehl <http://dev.stephendiehl.com/hask/> diff --git a/00_blog/00040_Haskell/00020_GHC-Notes/index.md b/00_blog/00040_Haskell/00020_GHC-Notes/index.md index c945319..acee63f 100644 --- a/00_blog/00040_Haskell/00020_GHC-Notes/index.md +++ b/00_blog/00040_Haskell/00020_GHC-Notes/index.md @@ -2,33 +2,35 @@ ## Some GHC Flags - -v verbose mode - -O2 level 2 optimizations - -rtsopts allow +RTS flags - -prof enable basic time and allocation profiling - -auto-all cost centers on all top level functions - (you can also add them via the SCC pragma) - -caf-all generate data for CAFs (constant applicative forms) - -fforce-recomp force recompilation + -v verbose mode + -O2 level 2 optimizations + -rtsopts allow +RTS flags + -prof enable basic time and allocation profiling + -auto-all cost centers on all top level functions + (you can also add them via the SCC pragma) + -fprof-auto replaced -auto-all + -caf-all generate data for CAFs (constant applicative forms) + -fprof-cafs replaced -caf-all + -fforce-recomp force recompilation -threaded Use threaed runtime -eventlog enables +RTS -l flag -Wall -Werror + -no-hs-main supress linking main module + Notes: you will obtain the profiling versions of dependancies via: stack install --profile [libraryname] - -fprof-auto replaced -auto-all - -fprof-cafs replaced -caf-all ## Some +RTS flags - -K set stack limit + -K set stack limit -s statistic reporting - -p profiling - -hc extract heap profile - -hy allocation by type + -p profiling + -hc extract heap profile + -hy allocation by type -hd allocation by constructor -ix x is sampling frequency in seconds. e.g. 0.01) -Nx x is number of cores to utilize diff --git a/00_blog/00040_Haskell/00040_Convex-and-Concave-Hulls/alpha.png b/00_blog/00040_Haskell/00040_Convex-and-Concave-Hulls/alpha.png Binary files differnew file mode 100644 index 0000000..a8cbe34 --- /dev/null +++ b/00_blog/00040_Haskell/00040_Convex-and-Concave-Hulls/alpha.png diff --git a/00_blog/00040_Haskell/00040_Graham-Scan/index.md b/00_blog/00040_Haskell/00040_Convex-and-Concave-Hulls/index.md index 195dbe1..d68abcd 100644 --- a/00_blog/00040_Haskell/00040_Graham-Scan/index.md +++ b/00_blog/00040_Haskell/00040_Convex-and-Concave-Hulls/index.md @@ -1,128 +1,20 @@ -Haskell – Convex Hull – Graham Scan -=================================== + December 2017 +# Calculating Convex and Concave Hulls -December 16, 2017 +Experimenting with Convex and Concave Hulls with Haskell -Playing with Convex Hulls (via Graham Scan) and SVG Export in Haskell: - -This is an embedded SVG generated by the Haskell programm below: +## Concave <svg style="background-color:black;border:3px solid green;margin:2px;" width="330" height="330"><circle cx="250.04284841107818" cy="201.75346959836142" r="5" fill="rgb(30,150,112)"></circle> <circle cx="168.06592772450588" cy="111.843758303498" r="5" fill="rgb(30,150,47)"></circle> <circle cx="189.1691117845287" cy="250.13932743386943" r="5" fill="rgb(30,150,107)"></circle> <circle cx="130.9047490592456" cy="253.98605115515113" r="5" fill="rgb(30,150,108)"></circle> <circle cx="133.43531697969132" cy="255.82160214659208" r="5" fill="rgb(30,150,109)"></circle> <circle cx="182.304020607504" cy="105.5457583516454" r="5" fill="rgb(30,150,60)"></circle> <circle cx="251.5850563588106" cy="65.40572671380644" r="5" fill="rgb(30,150,139)"></circle> <circle cx="171.80987991027797" cy="186.35194010383304" r="5" fill="rgb(30,150,37)"></circle> <circle cx="207.80255687618114" cy="132.29096928312123" r="5" fill="rgb(30,150,61)"></circle> <circle cx="195.49409554478555" cy="83.18625335312012" r="5" fill="rgb(30,150,87)"></circle> <circle cx="92.72787404887227" cy="119.1126315578156" r="5" fill="rgb(30,150,76)"></circle> <circle cx="132.01826662198954" cy="259.3032349925243" r="5" fill="rgb(30,150,113)"></circle> <circle cx="254.30961953454" cy="228.57029782885428" r="5" fill="rgb(30,150,131)"></circle> <circle cx="119.4923496517701" cy="224.99714968272923" r="5" fill="rgb(30,150,83)"></circle> <circle cx="104.9029796235115" cy="248.66327951701538" r="5" fill="rgb(30,150,112)"></circle> <circle cx="177.91310266020778" cy="126.62370162491455" r="5" fill="rgb(30,150,38)"></circle> <circle cx="266.34722960770284" cy="187.10030895652505" r="5" fill="rgb(30,150,123)"></circle> <circle cx="198.64979304554535" cy="188.53978156044514" r="5" fill="rgb(30,150,58)"></circle> <circle cx="153.9541873486683" cy="57.38878027501561" r="5" fill="rgb(30,150,103)"></circle> <circle cx="170.63539358861877" cy="176.00651132793615" r="5" fill="rgb(30,150,27)"></circle> <circle cx="28.36356558991553" cy="95.4663889254756" r="5" fill="rgb(30,150,148)"></circle> <circle cx="144.84264545840333" cy="98.7746298856041" r="5" fill="rgb(30,150,60)"></circle> <circle cx="190.22210041855752" cy="135.09803947887505" r="5" fill="rgb(30,150,42)"></circle> <circle cx="182.77513675509647" cy="226.9525049033775" r="5" fill="rgb(30,150,81)"></circle> <circle cx="91.5545715639725" cy="181.77301165017755" r="5" fill="rgb(30,150,73)"></circle> <circle cx="260.52976404909987" cy="126.7650903973776" r="5" fill="rgb(30,150,116)"></circle> <circle cx="199.24706728106065" cy="85.8145677264196" r="5" fill="rgb(30,150,87)"></circle> <circle cx="140.1028394863066" cy="228.94903207761297" r="5" fill="rgb(30,150,80)"></circle> <circle cx="86.45512221013155" cy="142.21354112994936" r="5" fill="rgb(30,150,74)"></circle> <circle cx="104.7684570753781" cy="95.55777241192189" r="5" fill="rgb(30,150,82)"></circle> <circle cx="109.8116912935771" cy="201.82250066393837" r="5" fill="rgb(30,150,69)"></circle> <circle cx="226.2427629753817" cy="260.4928511647599" r="5" fill="rgb(30,150,135)"></circle> <circle cx="207.52854584882476" cy="98.23832427848856" r="5" fill="rgb(30,150,82)"></circle> <circle cx="137.34727138289463" cy="248.54598831387364" r="5" fill="rgb(30,150,101)"></circle> <circle cx="67.6437518548912" cy="235.9987917257608" r="5" fill="rgb(30,150,126)"></circle> <circle cx="146.63935287123562" cy="199.14394352970618" r="5" fill="rgb(30,150,47)"></circle> <circle cx="166.09256427911302" cy="242.83302095042907" r="5" fill="rgb(30,150,94)"></circle> <circle cx="184.35531117256224" cy="161.9097796435418" r="5" fill="rgb(30,150,32)"></circle> <circle cx="135.0509917491549" cy="104.7711158701602" r="5" fill="rgb(30,150,57)"></circle> <circle cx="219.20921008912157" cy="115.18635102633722" r="5" fill="rgb(30,150,80)"></circle> <circle cx="163.3590840337916" cy="68.94091343798308" r="5" fill="rgb(30,150,91)"></circle> <circle cx="106.80531573718335" cy="199.21285711361014" r="5" fill="rgb(30,150,69)"></circle> <circle cx="91.69394054319545" cy="249.00283065566003" r="5" fill="rgb(30,150,120)"></circle> <circle cx="42.69884845673566" cy="208.11969850342197" r="5" fill="rgb(30,150,131)"></circle> <circle cx="150.6236743485051" cy="188.8620474963915" r="5" fill="rgb(30,150,36)"></circle> <circle cx="158.90382633613356" cy="274.07594874616575" r="5" fill="rgb(30,150,126)"></circle> <circle cx="203.43810936607744" cy="240.5130006472947" r="5" fill="rgb(30,150,104)"></circle> <circle cx="90.52909317079552" cy="217.88023089739372" r="5" fill="rgb(30,150,95)"></circle> <circle cx="142.0940864941062" cy="129.52923503909" r="5" fill="rgb(30,150,30)"></circle> <circle cx="183.3037554100898" cy="163.4224683254946" r="5" fill="rgb(30,150,31)"></circle> <circle cx="254.59761377280722" cy="194.8355635900217" r="5" fill="rgb(30,150,113)"></circle> <circle cx="70.01341642229187" cy="145.07162677904222" r="5" fill="rgb(30,150,90)"></circle> <circle cx="245.95274031933198" cy="105.6150023686217" r="5" fill="rgb(30,150,109)"></circle> <circle cx="179.3874489883276" cy="161.3271491454406" r="5" fill="rgb(30,150,26)"></circle> <circle cx="174.8322909478738" cy="98.24413130742855" r="5" fill="rgb(30,150,63)"></circle> <circle cx="76.57661314940059" cy="232.5620695235213" r="5" fill="rgb(30,150,117)"></circle> <circle cx="110.20050744456465" cy="131.53437983901722" r="5" fill="rgb(30,150,53)"></circle> <circle cx="101.02068320616426" cy="147.86628733061426" r="5" fill="rgb(30,150,57)"></circle> <circle cx="165.8572064460344" cy="278.14694842092365" r="5" fill="rgb(30,150,131)"></circle> <circle cx="100.51994290684408" cy="135.00585528086626" r="5" fill="rgb(30,150,61)"></circle> <circle cx="93.82764097353034" cy="129.06320594160917" r="5" fill="rgb(30,150,70)"></circle> <circle cx="253.87187416210415" cy="154.5167254215345" r="5" fill="rgb(30,150,105)"></circle> <circle cx="139.60104049751217" cy="105.10237893042421" r="5" fill="rgb(30,150,55)"></circle> <circle cx="217.63333767494922" cy="82.01911898999408" r="5" fill="rgb(30,150,102)"></circle> <circle cx="155.07651713848244" cy="202.01229698806958" r="5" fill="rgb(30,150,49)"></circle> <circle cx="38.84571396023169" cy="211.71370049299298" r="5" fill="rgb(30,150,137)"></circle> <circle cx="131.35457460373755" cy="229.43649756282707" r="5" fill="rgb(30,150,82)"></circle> <circle cx="101.8811149603446" cy="60.806865650812135" r="5" fill="rgb(30,150,114)"></circle> <circle cx="108.91357375361146" cy="183.38328826229434" r="5" fill="rgb(30,150,57)"></circle> <circle cx="98.29711330271346" cy="109.47482179229984" r="5" fill="rgb(30,150,77)"></circle> <circle cx="172.28688779196867" cy="181.46233752550535" r="5" fill="rgb(30,150,33)"></circle> <circle cx="93.77188129034651" cy="152.09728921642983" r="5" fill="rgb(30,150,65)"></circle> <circle cx="39.16221208499168" cy="220.08715706943792" r="5" fill="rgb(30,150,141)"></circle> <circle cx="82.90283027529738" cy="187.23987823799342" r="5" fill="rgb(30,150,83)"></circle> <circle cx="36.83140136457256" cy="237.10836498299798" r="5" fill="rgb(30,150,152)"></circle> <circle cx="159.04913429058357" cy="193.6137496983329" r="5" fill="rgb(30,150,41)"></circle> <circle cx="149.8458394746179" cy="243.69722670699878" r="5" fill="rgb(30,150,94)"></circle> <circle cx="139.0710264338086" cy="147.9219518871481" r="5" fill="rgb(30,150,18)"></circle> <circle cx="156.87676351678834" cy="196.31621769543472" r="5" fill="rgb(30,150,43)"></circle> <circle cx="76.22813867551673" cy="58.065254250002404" r="5" fill="rgb(30,150,132)"></circle> <circle cx="114.74404579519961" cy="250.4087840946835" r="5" fill="rgb(30,150,110)"></circle> <circle cx="87.15900106326063" cy="148.70527298969148" r="5" fill="rgb(30,150,72)"></circle> <circle cx="26.847893428897535" cy="218.50461482065617" r="5" fill="rgb(30,150,151)"></circle> <circle cx="167.86224317149043" cy="217.21693364547622" r="5" fill="rgb(30,150,67)"></circle> <circle cx="282.75471021838604" cy="222.40422121056434" r="5" fill="rgb(30,150,153)"></circle> <circle cx="113.65929983185622" cy="172.1380647926459" r="5" fill="rgb(30,150,47)"></circle> <circle cx="145.09413645816042" cy="155.25057732001034" r="5" fill="rgb(30,150,10)"></circle> <circle cx="237.53341559112823" cy="129.6627629148239" r="5" fill="rgb(30,150,91)"></circle> <circle cx="204.79599735549814" cy="127.38370156552024" r="5" fill="rgb(30,150,60)"></circle> <circle cx="67.74775493976351" cy="139.97850753416574" r="5" fill="rgb(30,150,94)"></circle> <circle cx="210.31226434244496" cy="247.09502723685614" r="5" fill="rgb(30,150,114)"></circle> <circle cx="138.5101000851674" cy="278.7105427190394" r="5" fill="rgb(30,150,132)"></circle> <circle cx="169.19801602950238" cy="114.05245580753565" r="5" fill="rgb(30,150,46)"></circle> <circle cx="248.30023598811576" cy="139.82948336104496" r="5" fill="rgb(30,150,100)"></circle> <circle cx="84.30932668117279" cy="219.93833030785126" r="5" fill="rgb(30,150,101)"></circle> <circle cx="132.24331417077946" cy="291.2609993001805" r="5" fill="rgb(30,150,146)"></circle> <circle cx="160.94658587409114" cy="77.98657154244181" r="5" fill="rgb(30,150,82)"></circle> <circle cx="189.89599533144758" cy="214.5141658021252" r="5" fill="rgb(30,150,73)"></circle> <circle cx="274.07238032907736" cy="114.61040292334776" r="5" fill="rgb(30,150,133)"></circle> <circle cx="173.4334175877005" cy="142.41875279561097" r="5" fill="rgb(30,150,23)"></circle> <circle cx="81.59666952240286" cy="157.09683628233245" r="5" fill="rgb(30,150,78)"></circle> <circle cx="113.74263460749069" cy="245.6984634962466" r="5" fill="rgb(30,150,105)"></circle> <circle cx="128.62844736870682" cy="89.1045872570648" r="5" fill="rgb(30,150,75)"></circle> <circle cx="117.09080103183433" cy="256.3606817576775" r="5" fill="rgb(30,150,114)"></circle> <circle cx="107.0510464556047" cy="63.6364881544602" r="5" fill="rgb(30,150,109)"></circle> <circle cx="146.06063748335822" cy="155.5476601817892" r="5" fill="rgb(30,150,9)"></circle> <circle cx="19.797156728201166" cy="208.00327375672293" r="5" fill="rgb(30,150,154)"></circle> <circle cx="224.6871261564196" cy="59.32941538253692" r="5" fill="rgb(30,150,125)"></circle> <circle cx="18.330634507062157" cy="169.68512490920642" r="5" fill="rgb(30,150,146)"></circle> <circle cx="117.71877593737015" cy="157.71566996945785" r="5" fill="rgb(30,150,39)"></circle> <circle cx="150.90744004872494" cy="125.69996651911103" r="5" fill="rgb(30,150,31)"></circle> <circle cx="172.0555296451493" cy="147.95967101995438" r="5" fill="rgb(30,150,19)"></circle> <circle cx="211.71510600782037" cy="168.6836805807738" r="5" fill="rgb(30,150,61)"></circle> <circle cx="60.24756518573737" cy="246.71025625213787" r="5" fill="rgb(30,150,140)"></circle> <circle cx="103.23366497661333" cy="219.01237316076927" r="5" fill="rgb(30,150,87)"></circle> <circle cx="273.7017283881007" cy="172.2120764305319" r="5" fill="rgb(30,150,127)"></circle> <circle cx="97.80303649638779" cy="204.85716575700624" r="5" fill="rgb(30,150,80)"></circle> <circle cx="221.46148887605563" cy="164.77249284618293" r="5" fill="rgb(30,150,71)"></circle> <circle cx="50.524491137739275" cy="89.6937642622213" r="5" fill="rgb(30,150,130)"></circle> <circle cx="204.0380699117014" cy="37.35498291700646" r="5" fill="rgb(30,150,135)"></circle> <circle cx="143.40838746301495" cy="259.3899906185589" r="5" fill="rgb(30,150,111)"></circle> <circle cx="266.77265013944714" cy="123.56187324575204" r="5" fill="rgb(30,150,123)"></circle> <circle cx="121.09007007148857" cy="87.19247610877495" r="5" fill="rgb(30,150,80)"></circle> <circle cx="80.22930186274945" cy="70.1701303865456" r="5" fill="rgb(30,150,120)"></circle> <circle cx="180.45553719901778" cy="175.95293706048568" r="5" fill="rgb(30,150,35)"></circle> <circle cx="222.7506070445607" cy="80.61735797855984" r="5" fill="rgb(30,150,106)"></circle> <circle cx="158.2801305209321" cy="168.2844490594726" r="5" fill="rgb(30,150,14)"></circle> <circle cx="209.07427850176043" cy="146.00598552038022" r="5" fill="rgb(30,150,58)"></circle> <circle cx="181.8649175345449" cy="96.87537796898624" r="5" fill="rgb(30,150,68)"></circle> <circle cx="57.818033309206335" cy="94.70613646665379" r="5" fill="rgb(30,150,121)"></circle> <circle cx="120.75849455577627" cy="136.86343872502906" r="5" fill="rgb(30,150,41)"></circle> <circle cx="238.4042177525126" cy="214.12837089906836" r="5" fill="rgb(30,150,108)"></circle> <circle cx="134.82175169469224" cy="282.8625044224542" r="5" fill="rgb(30,150,137)"></circle> <circle cx="124.37897828966902" cy="141.19895073915285" r="5" fill="rgb(30,150,35)"></circle> <circle cx="71.30829640124736" cy="228.6244751809119" r="5" fill="rgb(30,150,118)"></circle> <circle cx="202.8966932024821" cy="175.5553271682116" r="5" fill="rgb(30,150,55)"></circle> <circle cx="112.28137080688083" cy="198.61669563281163" r="5" fill="rgb(30,150,64)"></circle> <circle cx="230.79728693422757" cy="72.90445718027976" r="5" fill="rgb(30,150,118)"></circle> <circle cx="158.79949910260785" cy="182.82233984968175" r="5" fill="rgb(30,150,29)"></circle> <circle cx="58.56877652829822" cy="147.81482668362486" r="5" fill="rgb(30,150,102)"></circle> <circle cx="188.43313680897649" cy="169.0946893542551" r="5" fill="rgb(30,150,38)"></circle> <circle cx="183.18362562517675" cy="146.11507672367435" r="5" fill="rgb(30,150,31)"></circle> <circle cx="256.71894488922624" cy="172.26799561066733" r="5" fill="rgb(30,150,109)"></circle> <circle cx="245.03698870042268" cy="103.65831068003733" r="5" fill="rgb(30,150,110)"></circle> <circle cx="50.70099080152846" cy="87.39565736040664" r="5" fill="rgb(30,150,132)"></circle> <circle cx="130.64433518067872" cy="28.1630727673696" r="5" fill="rgb(30,150,137)"></circle> <circle cx="94.56724747823085" cy="150.4574267806313" r="5" fill="rgb(30,150,64)"></circle> <circle cx="67.04524904809107" cy="53.02953597638252" r="5" fill="rgb(30,150,143)"></circle> <circle cx="78.62648151898244" cy="81.82623533931174" r="5" fill="rgb(30,150,112)"></circle> <circle cx="161.15153490662175" cy="96.99587052613042" r="5" fill="rgb(30,150,61)"></circle> <circle cx="245.67175110458567" cy="217.1949486286303" r="5" fill="rgb(30,150,116)"></circle> <circle cx="157.1543105644771" cy="197.82600606935443" r="5" fill="rgb(30,150,45)"></circle> <circle cx="277.47686405127035" cy="159.7874794173272" r="5" fill="rgb(30,150,130)"></circle> <circle cx="233.345787687867" cy="166.3550830285023" r="5" fill="rgb(30,150,84)"></circle> <circle cx="117.83415920099087" cy="164.15103726228338" r="5" fill="rgb(30,150,40)"></circle> <circle cx="120.13909214312396" cy="172.46043638719644" r="5" fill="rgb(30,150,41)"></circle> <circle cx="205.5110421762653" cy="72.98191491764617" r="5" fill="rgb(30,150,102)"></circle> <circle cx="96.80163765991092" cy="62.92764545891779" r="5" fill="rgb(30,150,115)"></circle> <circle cx="124.88959943706861" cy="225.15044973370053" r="5" fill="rgb(30,150,81)"></circle> <circle cx="164.15746228129717" cy="208.86982033897232" r="5" fill="rgb(30,150,58)"></circle> <circle cx="61.99262838338286" cy="146.89828049656404" r="5" fill="rgb(30,150,99)"></circle> <circle cx="172.85767813829926" cy="78.87359339217413" r="5" fill="rgb(30,150,83)"></circle> <circle cx="253.24460591758893" cy="78.41050145160236" r="5" fill="rgb(30,150,132)"></circle> <circle cx="118.82587572803565" cy="135.954087178179" r="5" fill="rgb(30,150,43)"></circle> <circle cx="98.37373962332532" cy="154.76680314997353" r="5" fill="rgb(30,150,60)"></circle> <circle cx="122.31937398668295" cy="165.877836976854" r="5" fill="rgb(30,150,36)"></circle> <circle cx="149.9286260021866" cy="46.27747926759328" r="5" fill="rgb(30,150,115)"></circle> <circle cx="150.6188359447945" cy="196.58148153111807" r="5" fill="rgb(30,150,44)"></circle> <circle cx="96.17812624734673" cy="29.840537240648665" r="5" fill="rgb(30,150,146)"></circle> <circle cx="128.59108692837646" cy="194.72588208165476" r="5" fill="rgb(30,150,50)"></circle> <circle cx="38.82122769921369" cy="75.5662312500352" r="5" fill="rgb(30,150,149)"></circle> <circle cx="79.94903569579193" cy="186.85152375858772" r="5" fill="rgb(30,150,86)"></circle> <circle cx="204.77448960563186" cy="203.64418479165812" r="5" fill="rgb(30,150,73)"></circle> <circle cx="102.88584275265274" cy="197.78063641998918" r="5" fill="rgb(30,150,71)"></circle> <circle cx="159.65478381235536" cy="151.46210092241446" r="5" fill="rgb(30,150,6)"></circle> <circle cx="134.10239921221842" cy="161.49132008992956" r="5" fill="rgb(30,150,23)"></circle> <circle cx="139.09958643074796" cy="219.08371036054947" r="5" fill="rgb(30,150,70)"></circle> <circle cx="146.567509740401" cy="147.39910865707066" r="5" fill="rgb(30,150,12)"></circle> <circle cx="131.83426320463218" cy="162.48898240420658" r="5" fill="rgb(30,150,25)"></circle> <circle cx="173.79168328304365" cy="42.17798379123914" r="5" fill="rgb(30,150,121)"></circle> <circle cx="109.95961714856101" cy="176.03754103367197" r="5" fill="rgb(30,150,52)"></circle> <circle cx="193.05669580827944" cy="188.37810635692216" r="5" fill="rgb(30,150,53)"></circle> <circle cx="104.13084921683644" cy="251.78865585330408" r="5" fill="rgb(30,150,116)"></circle> <circle cx="151.87833723048243" cy="141.41758941633188" r="5" fill="rgb(30,150,14)"></circle> <circle cx="170.37984822769394" cy="82.74727274516178" r="5" fill="rgb(30,150,78)"></circle> <circle cx="269.0943849070194" cy="126.07704256534687" r="5" fill="rgb(30,150,125)"></circle> <circle cx="125.65122538235366" cy="91.64498546299714" r="5" fill="rgb(30,150,74)"></circle> <circle cx="197.53172426918525" cy="128.69408459081865" r="5" fill="rgb(30,150,53)"></circle> <circle cx="174.6642667835747" cy="158.9818125733492" r="5" fill="rgb(30,150,21)"></circle> <circle cx="24.442195159380894" cy="149.95618131450235" r="5" fill="rgb(30,150,138)"></circle> <circle cx="230.57251917564554" cy="160.3740796367529" r="5" fill="rgb(30,150,80)"></circle> <circle cx="116.98152224764455" cy="119.15376321927269" r="5" fill="rgb(30,150,55)"></circle> <circle cx="76.56308571870836" cy="116.27351644357717" r="5" fill="rgb(30,150,92)"></circle> <circle cx="114.18131147378502" cy="228.83119145309104" r="5" fill="rgb(30,150,89)"></circle> <circle cx="61.43526198061147" cy="189.2999144311051" r="5" fill="rgb(30,150,105)"></circle> <circle cx="47.159274262692136" cy="232.7974361297379" r="5" fill="rgb(30,150,141)"></circle> <circle cx="182.3516235175878" cy="147.2513501676052" r="5" fill="rgb(30,150,30)"></circle> <circle cx="212.65566528240188" cy="106.8365872143227" r="5" fill="rgb(30,150,79)"></circle> <circle cx="103.57241974005441" cy="244.94215489038754" r="5" fill="rgb(30,150,110)"></circle> <circle cx="118.74222089776532" cy="72.89123743199185" r="5" fill="rgb(30,150,95)"></circle> <circle cx="249.90029463264338" cy="210.31306906279752" r="5" fill="rgb(30,150,116)"></circle> <circle cx="138.08211482254237" cy="201.93298825621986" r="5" fill="rgb(30,150,53)"></circle> <circle cx="99.45732504409123" cy="125.68120399343496" r="5" fill="rgb(30,150,66)"></circle> <circle cx="95.25417908245312" cy="199.8722971385956" r="5" fill="rgb(30,150,79)"></circle> <circle cx="173.5225523778074" cy="183.25325411366197" r="5" fill="rgb(30,150,35)"></circle> <circle cx="161.10556608174647" cy="287.6615940190875" r="5" fill="rgb(30,150,141)"></circle> <circle cx="99.12828988863924" cy="192.5533080036565" r="5" fill="rgb(30,150,71)"></circle> <circle cx="138.3352868758438" cy="198.47497165114282" r="5" fill="rgb(30,150,49)"></circle> <circle cx="193.78642259086737" cy="131.00758347474238" r="5" fill="rgb(30,150,48)"></circle> <circle cx="232.588767217581" cy="166.3351798078713" r="5" fill="rgb(30,150,83)"></circle> <circle cx="39.31251655429242" cy="177.08833200695184" r="5" fill="rgb(30,150,125)"></circle> <circle cx="185.95704286695798" cy="177.33472005753862" r="5" fill="rgb(30,150,40)"></circle> <circle cx="147.90048340005285" cy="71.10204540244274" r="5" fill="rgb(30,150,89)"></circle> <circle cx="166.8845546562491" cy="172.74666158680589" r="5" fill="rgb(30,150,22)"></circle> <circle cx="277.6246746037615" cy="90.30367358125177" r="5" fill="rgb(30,150,147)"></circle> <circle cx="163.7772455221003" cy="119.59515393163443" r="5" fill="rgb(30,150,38)"></circle> <circle cx="100.8084390756384" cy="179.4519113235002" r="5" fill="rgb(30,150,63)"></circle> <circle cx="232.797670719027" cy="208.95839448193917" r="5" fill="rgb(30,150,100)"></circle> <circle cx="116.20169369192108" cy="215.30258202242675" r="5" fill="rgb(30,150,76)"></circle> <circle cx="129.14679183749018" cy="162.7114418319233" r="5" fill="rgb(30,150,28)"></circle> <circle cx="172.21836963279975" cy="53.36276325209766" r="5" fill="rgb(30,150,109)"></circle> <circle cx="122.18074560789485" cy="31.35034324083615" r="5" fill="rgb(30,150,135)"></circle> <circle cx="234.92525075624567" cy="197.12521379760366" r="5" fill="rgb(30,150,95)"></circle> <circle cx="287.55861698920245" cy="191.54124064684203" r="5" fill="rgb(30,150,146)"></circle> <circle cx="208.95996913096113" cy="86.31885888350531" r="5" fill="rgb(30,150,92)"></circle> <circle cx="117.94515643676408" cy="125.74735207871876" r="5" fill="rgb(30,150,50)"></circle> <circle cx="97.65527429491222" cy="84.40941345270775" r="5" fill="rgb(30,150,96)"></circle> <circle cx="148.98989317857215" cy="107.68365082202222" r="5" fill="rgb(30,150,50)"></circle> <circle cx="83.80736835288073" cy="136.33946071934116" r="5" fill="rgb(30,150,78)"></circle> <circle cx="199.93779378476336" cy="138.9591143291108" r="5" fill="rgb(30,150,50)"></circle> <circle cx="158.33576748574276" cy="205.38810908810458" r="5" fill="rgb(30,150,53)"></circle> <circle cx="157.50068512278443" cy="189.02964217352948" r="5" fill="rgb(30,150,36)"></circle> <circle cx="153.9943950342934" cy="149.63839051508984" r="5" fill="rgb(30,150,5)"></circle> <circle cx="227.12941615549062" cy="152.9883523085731" r="5" fill="rgb(30,150,76)"></circle> <circle cx="206.6719685811751" cy="116.71508779989065" r="5" fill="rgb(30,150,68)"></circle> <circle cx="148.85052880252837" cy="109.67806598750374" r="5" fill="rgb(30,150,48)"></circle> <circle cx="226.66377000731163" cy="61.32427435125567" r="5" fill="rgb(30,150,125)"></circle> <circle cx="66.10772769569768" cy="110.10357863882781" r="5" fill="rgb(30,150,105)"></circle> <circle cx="152.27636978490196" cy="114.5539300162203" r="5" fill="rgb(30,150,43)"></circle> <circle cx="135.56796817958528" cy="127.40915255930368" r="5" fill="rgb(30,150,35)"></circle> <circle cx="195.72769880316034" cy="203.4027436123629" r="5" fill="rgb(30,150,67)"></circle> <circle cx="130.7530263067129" cy="244.7852266812409" r="5" fill="rgb(30,150,98)"></circle> <circle cx="36.438341384815075" cy="210.6090541896294" r="5" fill="rgb(30,150,139)"></circle> <circle cx="176.71218763469287" cy="137.54323300750582" r="5" fill="rgb(30,150,29)"></circle> <circle cx="174.45032008232968" cy="209.2316111886315" r="5" fill="rgb(30,150,61)"></circle> <circle cx="68.73068617514102" cy="52.28176780869747" r="5" fill="rgb(30,150,142)"></circle> <circle cx="162.4456402979608" cy="73.76239706732053" r="5" fill="rgb(30,150,86)"></circle> <circle cx="108.00141921697366" cy="109.55469140282139" r="5" fill="rgb(30,150,69)"></circle> <circle cx="162.96141476843476" cy="141.23102327916624" r="5" fill="rgb(30,150,16)"></circle> <circle cx="125.9345304765698" cy="238.19247603714848" r="5" fill="rgb(30,150,93)"></circle><line x1="130.64433518067872" y1="28.1630727673696" x2="96.17812624734673" y2="29.840537240648665" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="96.17812624734673" y1="29.840537240648665" x2="67.04524904809107" y2="53.02953597638252" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="67.04524904809107" y1="53.02953597638252" x2="38.82122769921369" y2="75.5662312500352" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="38.82122769921369" y1="75.5662312500352" x2="28.36356558991553" y2="95.4663889254756" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="28.36356558991553" y1="95.4663889254756" x2="18.330634507062157" y2="169.68512490920642" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="18.330634507062157" y1="169.68512490920642" x2="19.797156728201166" y2="208.00327375672293" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="19.797156728201166" y1="208.00327375672293" x2="36.83140136457256" y2="237.10836498299798" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="36.83140136457256" y1="237.10836498299798" x2="132.24331417077946" y2="291.2609993001805" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="132.24331417077946" y1="291.2609993001805" x2="161.10556608174647" y2="287.6615940190875" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="161.10556608174647" y1="287.6615940190875" x2="226.2427629753817" y2="260.4928511647599" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="226.2427629753817" y1="260.4928511647599" x2="282.75471021838604" y2="222.40422121056434" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="282.75471021838604" y1="222.40422121056434" x2="287.55861698920245" y2="191.54124064684203" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="287.55861698920245" y1="191.54124064684203" x2="277.6246746037615" y2="90.30367358125177" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="277.6246746037615" y1="90.30367358125177" x2="251.5850563588106" y2="65.40572671380644" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="251.5850563588106" y1="65.40572671380644" x2="204.0380699117014" y2="37.35498291700646" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="204.0380699117014" y1="37.35498291700646" x2="130.64433518067872" y2="28.1630727673696" style="stroke:rgb(255,0,0);stroke-width:2"></line></svg> +SVG generated via Graham Scan + +## Convex +{}\ +Alpha Shapes and Concave Hulls obtained from the delaunay triangulation + +## Ref + +* STOC '83 Proceedings of the fifteenth annual ACM symposium on Theory of computing / Primitives for the manipulation of general subdivisions and the computation of Voronoi diagrams -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} ---------------------------------------------------------------------------------------------- --- --- GRAHAM SCAN IMPLEMENTATION --- --- This little haskell programm calulates the Convex Hull for a set of 2D points. --- It ships wit a main function that feeds the Graham Scan algorithm with some --- random points and generates a simple SVG of the input points and resulting envelope. --- A simple SVG encoder is included. --- --- Alogrithm used: https://en.wikipedia.org/wiki/Graham_scan --- --- CREDITS -- --- --- Michal Idziorek <m.i@gmx.at> --- 16 December 2017 --- ---------------------------------------------------------------------------------------------- - -import Data.List -import System.Random - ---------------------------------------------------------------------------------------------- - --- GRAHAM SCAN -- - --- Three points are clockwise if ccw < 0. -ccw (p1x,p1y) (p2x,p2y) (p3x,p3y) = (p2x - p1x)*(p3y - p1y) - (p2y - p1y)*(p3x - p1x) - --- Calculate the slope defined by 2 points. (return Infinity, if points are identical). -slope (ax,ay) (bx,by) | (ax,ay ) == (bx,by) = 1/0 -- Infinity - | otherwise = (bx-ax)/(by-ay) - --- Comparison function to sort points counterclockwise (given a reference point). -slope_cmp a b c = compare (slope a c) (slope a b) - --- Comparison function using the y and x coordinates for ordering. -graham_cmp (ax,ay) (bx,by) | ay /= by = compare ay by - | otherwise = compare ax bx - --- Graham scan on prepared data. this will calculate the convex hull. -graham_calc [] hs = hs -graham_calc (x1:xs) hh | length(hh) < 2 = graham_calc xs (x1:hh) -graham_calc xx@(x1:xs) hh@(h1:h2:hs) | ccw x1 h1 h2 < 0 = graham_calc xs (x1:hh) - | otherwise = graham_calc xx (h2:hs) - --- Find the starting point, sort all points counterclockwise and perform the graham scan. -graham xs = graham_calc sortedPoints [] - where minPoint = minimumBy graham_cmp xs - sortedPoints = sortBy (slope_cmp minPoint) xs - ---------------------------------------------------------------------------------------------- - --- XML ENCODING-- - -xml_attr (x:xs) = x++"=\""++(head xs)++"\" " -xml_enc tag attrs body = "<"++tag++" "++xml_attrs++">"++body++"</"++tag++">" - where xml_attrs = unlines $ map xml_attr attrs - --- SVG ENCODING -- - --- hardcoded scaling and panning function -svg_transf x = x*30+5 - -line_to_svg ((x1,y1),(x2,y2)) = xml_enc "line" [["x1",show lx1],["y1",show ly1], - ["x2",show lx2],["y2",show ly2], - ["style", "stroke:rgb(255,0,0);stroke-width:2"]] "" - where lx1=svg_transf x1 - lx2=svg_transf x2 - ly1=svg_transf y1 - ly2=svg_transf y2 - -point_to_svg (x,y) = xml_enc "circle" [["cx",show cx],["cy",show cy],["r","5"], - ["fill","rgb(30,150,"++(show (floor dist))++")"]] "" - where cx=svg_transf x - cy=svg_transf y - dist= (sqrt ((x-5)*(x-5) + (y-5)*(y-5)))*255/8 - - - --- draws SVG points and lines (in hardcoded sizes and colors) -svg_draw p l = xml_enc "svg" [style,["width","330"],["height","330"]] body - where style = ["style", - "background-color:black;border:3px solid green;margin:2px;"] - body = (unlines (map point_to_svg p )) ++ - (unlines (map line_to_svg l )) - --- calculate convex hull and generate svg -svg_graham xs = svg_draw xs (zip hull hull_open) - where hull_open = graham xs - hull = (last hull_open) : hull_open - --- RANDOMIZING -- - -randomPoints g cnt = take cnt (zip r10a r10b) - where r5 = randomRs (0,5) g :: [Double] - r10a =zipWith (+) r5 (drop cnt r5) - r10b =zipWith (+) (drop (2*cnt) r5) (drop (3*cnt) r5) - ---------------------------------------------------------------------------------------------- - --- MAIN -- - --- Note that this is the only place of impurity in this source-file. --- Is is subject to side effects due to I/O (we are writng to stdout) --- and the random number generator. -main = do - g <- newStdGen - putStr (svg_graham (randomPoints g 25)) - putStr (svg_graham (randomPoints g 50)) - putStr (svg_graham (randomPoints g 100)) - putStr (svg_graham (randomPoints g 250)) - putStr (svg_graham (randomPoints g 500)) - putStr (svg_graham (randomPoints g 1500)) - ---------------------------------------------------------------------------------------------- -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +## Git +* <https://gitweb.softwarefools.com/?p=miguel/haskell.git;a=tree;f=hulls> diff --git a/00_blog/00040_Haskell/00220_Neural-Networks/index.md b/00_blog/00040_Haskell/00220_Neural-Networks/index.md index 16b39d0..e298046 100644 --- a/00_blog/00040_Haskell/00220_Neural-Networks/index.md +++ b/00_blog/00040_Haskell/00220_Neural-Networks/index.md @@ -64,6 +64,12 @@ yourself familiar with, when learning about neural networks. * backpropagation (based on 4 fudnamental equations / check proofs) * weighted input * saturated neuron +* softmax +* log-likehood +* overfitting +* hyper-parameters +* validation data +* regularization (l1,l2,dropout) ## Git Repo @@ -75,3 +81,4 @@ yourself familiar with, when learning about neural networks. * [2] <http://yann.lecun.com/exdb/mnist/> * [3] <http://www.deeplearningbook.org/> * [4] <https://medium.com/tebs-lab/how-to-classify-mnist-digits-with-different-neural-network-architectures-39c75a0f03e3> +* [5] <https://adeshpande3.github.io/adeshpande3.github.io/The-9-Deep-Learning-Papers-You-Need-To-Know-About.html> diff --git a/00_blog/00040_Haskell/00240_FFI-Foreign-Function-Interface/index.md b/00_blog/00040_Haskell/00240_FFI-Foreign-Function-Interface/index.md new file mode 100644 index 0000000..892f4cd --- /dev/null +++ b/00_blog/00040_Haskell/00240_FFI-Foreign-Function-Interface/index.md @@ -0,0 +1,19 @@ + March 2019 +# Haskell - Foreign Function Interface + +Haskell's FFI allows easily to cooperate with other languages. Foreign functions can call Haskell code and vice versa. +Simple examples can be found in my git repository [1]. For now, the provided Makefile exposes two interesting targets: + +* **c\_from\_hask** - simple program with a C function called from Haskell. +* **hask\_from\_c** - simple programm with a Haskell function called from C. + +The next step is to pass more complicated structures via _ForeignPtr_'s. + +## Notes + +* since version 8.4 GHC guarantees that garbage collection will never occur during an unsafe call. + +## Ref +* [1] <https://gitweb.softwarefools.com/?p=miguel/haskell.git;a=tree;f=ffi> +* [2] <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi-chap.html#> +* [3] <https://wiki.haskell.org/Foreign_Function_Interface> |
