From 21315240178c0fa0017a36e6fefc7b80380ea438 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 23 Jul 2023 10:09:34 +0200 Subject: [PATCH] README tweaks, free seed in examples --- README.md | 4 +++- examples/01_one_sample/example | Bin 22216 -> 22248 bytes examples/01_one_sample/example.c | 1 + examples/02_many_samples/example | Bin 22256 -> 22288 bytes examples/02_many_samples/example.c | 1 + examples/03_gcc_nested_function/example | Bin 22272 -> 22312 bytes examples/03_gcc_nested_function/example.c | 1 + examples/04_sample_from_cdf_simple/example | Bin 22360 -> 22400 bytes examples/05_sample_from_cdf_beta/example | Bin 22384 -> 22424 bytes squiggle.h | 3 +++ 10 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d800382..2d77667 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Squiggle.c -A self-contained C99 library that provides a subset of [Squiggle](https://www.squiggle-language.com/)'s functionality in C. +A self-contained C99 library that provides a subset of [Squiggle](https://www.squiggle-language.com/)'s functionality in C. It should be fast, but at the margin, simplicity of implementation wins over speed. ## Why C? @@ -79,6 +79,8 @@ Behaviour on error can be toggled by the `EXIT_ON_ERROR` variable. This library ## To do list +- [ ] Explain correlated samples +- [ ] Add tests in Stan? - [ ] Have some more complicated & realistic example - [ ] Add summarization functions: 90% ci (or all c.i.?) - [ ] Systematize references diff --git a/examples/01_one_sample/example b/examples/01_one_sample/example index bc04f21ec8d9ec8805f8d5d2e1090528e2150aa9..ce809912ade8a722fce2fa955e309b83327ba04b 100755 GIT binary patch delta 2939 zcmZ8jeNa@_6@T}!=^5a(R+#b>1o>T@;pve%*p|M({<5(gq=-_8WY z?*_D~$`1yVY@Jth`a%9mkjj?RVm$bJ%|j?*D@Y}~%xe+sX*D+;pd+@~ z#`DRs?dYR_+1zX!J+Q4{O;l`8V@s&n-faBoH&ONfB+*fuYo_jnVmQ%x$6?{Uq}bed z=xh7j)JLIt;}44aRk2hpEM(u=IUV};^-0uX-)MaIe$<$G%2?o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A_%iz4h*SFsLq|0*$Pj^qabVi=63l`OpITtd2ddvq}}ds+kgIr z9>$DE%*mbb>`K_w_^o16=R8InQL=j$gsd=C8}PaHW}jH;201XI$5A8)E$_P}N#5OJ z5@~klUDOYdP9qcYro;}onZRyz&`wV=tEJ zp}8%#=XJ{W=EyrVRkK)cq-i@n=FQJLhT|#+r{z6mTGm?HHJju{5r0ceJ0t4v=vQ8) z@I6>Y;*g3~m}m-Ed^8~^Z}L0Tn*ZvHFa;w-ns|x4X?_-@6=|6T$(qiwD5C4u_#Lol z^n2Rnz-7#C3;}+C>Wa|bv?Z*a{+O1*!gM*U)bW~23@HLZ{i|9`8R@x>wV!i7HiHDl z&7ujw)H1E;El~6sC3}xAJNOEve-v1`<0Ne(Fft%u3_PS0a zBE>%c4$ko($eR0O+wBC+o2!=&i&9#4=XuOlHHwAOa{=Fow>j6C1h#I#+Kz8l&!HV@~my$@me23F`! zKB4#WmYJkEWS_r+#V9=Am$ximl0r@4$cLeg;mEyEV<4j-ZW_0^EUmgmx`m09(xX`$sT#5THJT4EW8ltFoAPZw{-_GMr@OVCRcZRx=&-{1sa zgL(jb2Mv`~TQ5O60t>oZ!fR;Iwn!U$~)ds<6R_t zi6Ulzm6aqau6DC33Rlf@IPMVW_>iaDhNm3S~297+E!C6kA`at(YRad_7)jC8pg~;=?99=-IP;@6{Pj} z7SS$zyXjP&+dFDJwq}#3%CPUJYtW7x+SxS8#CiyCRg|m*nU6wBHm-*)%44jb29!GH zAQr9*)#E83%It36FnT$1b^d81wtEJD^8aFx=$B!)EdvKjjOB<9g{R`8Lu-#SikZyO zt?RDFv6m>^5VUp9*By4!u7>?=ifoO+xzb{tn?*G)y1MZJ!`g)IlUG(BQh NjTdGbqo1tH`X5YNYdHV_ diff --git a/examples/01_one_sample/example.c b/examples/01_one_sample/example.c index 337b9ce..4badc5e 100644 --- a/examples/01_one_sample/example.c +++ b/examples/01_one_sample/example.c @@ -39,6 +39,7 @@ int main(){ float result_one = sample_mixture(samplers, weights, n_dists, seed); printf("result_one: %f\n", result_one); + free(seed); } /* diff --git a/examples/02_many_samples/example b/examples/02_many_samples/example index 423e7879c316ef232ae85194e2751984a440dc8d..6bc060eecfccec875ea56c0c33c5936de18977d0 100755 GIT binary patch delta 1645 zcmYk6ZA_C_6vyv$ zJ+?Vpr@ojB=6!IWcVv0s-I!{P@1VhyMSKa3r_AHG=?QZ|e4YPB=>8)rG+X0S{uQF5 zhg!`~s`06e>D@{D1MitXR980X{zv-maZ^}JuCpeFE=&s%)=Ze{{t0L`R#mePh5Dni z*Q)Bf&zshUwdQkStz|^BpZm6>qfpE4k~Idj1s4^*g|24(r5u=|Axk+amgPKyToxB! zL%S`N{4fn#T6hIz=d3YrGcp#u!x=-F-$;gBv@ge5SqMFJd_sr;Xe=~9^`CLrjw{6*T=WgMDEH$Cqi!~BUrW=GtCj!_MS#B za149!Z{*jz(+(#xR($VOy?fbbv_9`0!&pKjTiOm9&$F0Y5yg3b(e^xxdSs%PDBHSU z=}(|O>nAyxSgh?Gil(##E3gJB56+oQd6+sEb|%;$N47{a(anXKwndNqkb$wauGjv| zeJC#oWm$rrXpV~pDzsH7lLp#gTdwpO=u2C+Ezic7YqiJ!qpQi|zw7e4{L@W(_mWh| zjdca`Ce_eDC@^6gQu~V%`A+$GvM@5P2~mW+>ZlOSU)o~%JKppf-|CSKz!SdTebb-D}Ax1#^ln}A8C_IdfLEl{=PJqMUAgJEMLBQ>x zB@QQsr7}{SS-hNboaua&mOAtKF=}(B&pmQgh|$QB=*I-?!#G2|PP6OObs_LpA|@lJ zF#4d)jY>>v!x(4(r`5r~f+73dLSxvejFL+7_;xBTF{gE5r2|oE85mx4@(8_BGC$3W zzCRPuqmeE|c9Fkier63iD>E|PXis06Y%-c$Mm17x5#rX65XWU4CQncUZ4g>%M2Tw6(8i$!XEa%>yw#7Wp)@_t zhuI0*T)8RYcDINEP8uI3m>7MS2&7InKC(JvnTr$)u!OgRoPM917BMIjNU^_-44Z+PaE7V zyoWBh*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Xz3275pCsA)-`@m zzHFkr=nWyVWZWqsoS+kIlJ+!o4eS{qVx)ajh<4Bg_JTd&05}PbN&nA6+yX;x39%RZ zEZ{40KiDqqSs~7XE^t`G4l?BzAtt0_P6#ikc!V$nV8L%flz}k|NCV1BikdvS;x&LDqEAE1mYNcw-xm?WkV@@jHKo4@vPs?ZuN*Iq4URc>9wK{0S&~nyjP0(&ZbFXOf)T7Y4=8*}`U;$A) z!sNtF5EH!*zO!^L*AcXU*?C&bwFa3`b_1p7*@EN)jnkgIhD~E~h9|LMk8H9&*P#8i zMw5CO`W@&d`a7>Qs0a_EsP_CngYaQmsGwNkF7sb)O>73XQRSbCZ7 zRR_z0IXv#IS2f;5>fY9(88B0*BQw^UAY(JOded>_`VgvYqFs(?-bBwktQxPGPB~g& zL@ExHuNI@8`jtO;37ssDj%4^*WNW}y*^21<^5|G65|n|ORaUAq)q?X8n%SMNW!wFmS}FO7 Pd~Ium-+F}lcP0G?1|iPA diff --git a/examples/05_sample_from_cdf_beta/example b/examples/05_sample_from_cdf_beta/example index 4bc05546f6f5aa14181768f9bd9cf4c817c6fc40..7f3c14e39d926d985fe72bf19cf4bd801c667d9b 100755 GIT binary patch delta 1640 zcmX|BeQZ-z6o2=v-P(=ywfk@@U+bXlx-UBH$`)X<;-If=;K({e9RrLIK!{5mvLFdV z$XJ6jTaGc)U_|2|Ob7!WiJKw_^2a0w2O2V?vLRE7FgFbp+gz_Y`XI(X} ztUNoe)b}f%v)`;=KTFBlBg)ghcU+L=!4djs<_*~}Lc3h0bk_L{J4nnGkiWP|6|Q+K znVMbo^7$kha=nlmmn2EOchFl^M5y+goSznbN4?OZpZ&@Clc%I{ zW%@t0HEQG`YWJYvX&DFsCO=H1FWnpE6J~Pfw6Z+v&Z(Sr$}CB5*x>c|KvTTq%HGfa z;~cGcdT-+awJp66j@kEKQrpV>|cA4~a>1I0YairbSt(8A3EelYPNOZ+SL!Nio zCVDORKz0|FrR+TuOX=vHi#tf^0vk(NNJV)KNp8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*RBngOWaEVn>Ar4qDzM6Uks;rqan3WwvKW# z&he`>nlYHNf&m-OTnm-7dL76?$#$rrk|(G;vn?_Sa?np)pw&!Es`Y>WdIV$p-TUS? zui_K?(3aJ^D^%kW71;~<1ifzG&HKn}x2By>Va(lF;hA(dRCxY%*SkG|2Dvw@A97uF z#zTxl>wA7i5q2IqpnH-8l(2ZepV3DFGt!8Vms7>0zVr-d-VFSsp4 z57=@?h|j?h@Ow26oL2Qeg$RJQSs_}~cVH*j0rsiBPl$_P4>%^VF4i(9#4R;|9s0o* zEOcWS67C664HnD`aS-ePUsL@BGyt|N3h^;GvLwU;*t{&n)^OChFT_4@#E-^6KR68* zte`$P1Qu(8KNOb0Xpb|Q+vteX$Op;eOy@l`>@=FYF%5>VSU)xxXK{z zIP-@PPp>7Iz!}^a+Tlv#hp53-#fRu4*Cswf*Ie<5<1<1y9?R`V?P;2GB_;M_ZiSCU z#t|7Kb8eF56ef8~jmXhf>AF5zTN=r%aMkI`RGYhnmr#3ddT9)_8Vt^b!Cio@9#uO8 zZ33DrsD!i*XaQ*6HBIgNEVLowc}C3;tgpzDSFTxxHAby@4vh_?eTqKJb4I93m|3LB zyjQkOs3zv_Tq~0R&OnR74%Rg_RDv6TUO-3kpVgLN`UjCgi^cIujNYT6oFZBB+m+)* zhr>bo-Cf3ICF7YX&Id?WGAb?DmG4R-xEi}rI?21~LfJ81Oey6K*tO+G^OY^?pJA*5 z{iC`>o;MS(H1Zb3Tv->cbUZh}6;sW0nDm929@J&){r1p1^trwMw1oejSL?H5<+V|) evsqcG7o6XumBxIXsWSAWlXf)a^L{$gl>Q$)-rN=d diff --git a/squiggle.h b/squiggle.h index 84d95eb..31eb537 100644 --- a/squiggle.h +++ b/squiggle.h @@ -17,6 +17,9 @@ float sample_normal(float mean, float sigma, uint32_t* seed); float sample_lognormal(float logmean, float logsigma, uint32_t* seed); float sample_to(float low, float high, uint32_t* seed); +float sample_gamma(float alpha, uint32_t* seed); +float sample_beta(float a, float b, uint32_t* seed); + // Array helpers float array_sum(float* array, int length); void array_cumsum(float* array_to_sum, float* array_cumsummed, int length);