I think a gsl addon would be worthwhile, and looked at this some time ago. gsl can be called directly, e.g.
gsl_rng_env_setup=: ('libgsl.so gsl_rng_env_setup > x')&cd gsl_rng_alloc=: ('libgsl.so gsl_rng_alloc > x x')&cd gsl_ran_gaussian=: ('libgsl.so gsl_ran_gaussian > d x d')&cd gsl_ran_gaussian_pdf=: ('libgsl.so gsl_ran_gaussian_pdf > d d d')&cd gsl_ran_poisson=: ('libgsl.so gsl_ran_poisson > i x d')&cd A=: gsl_rng_env_setup'' B=: gsl_rng_alloc A gsl_ran_gaussian B;1 0.133919 gsl_ran_gaussian_pdf 1;2 0.176033 gsl_ran_poisson B;10 14 However, you probably want to extend gsl to allow J to call routines with list arguments or results, e.g. #include "jgsl.h" unsigned int jgsl_ran_poisson(double mu) { init(); return gsl_ran_poisson(rng, mu); } unsigned int *jgsl_ran_poissonv(double mu, int len) { init(); unsigned int *buf=(unsigned int *)malloc(len * sizeof(unsigned int)); for (int i=0;i<len;i++) buf[i]=gsl_ran_poisson(rng, mu); return buf; then: NB. generate len random integers from poisson distribution with mean mu. ran_poissonv=: 3 : 0 'mu len'=. y p=. jgsl_ran_poissonv mu,len r=. _2 ic memr p,0,len*4 memf p r ) ran_poissonv_jgsl_ 10,5 8 7 7 14 10 On Thu, Feb 25, 2021 at 10:37 PM Bill Harris <bill_har...@facilitatedsystems.com> wrote: > > Interesting thread. I once thought of trying to interface J to Stan > <https://mc-stan.org/>--or to suggest someone more skilled at it try. As > you can see on the installation <https://mc-stan.org/users/interfaces/> > page, Stan already has interfaces from R, Python, MATLAB, Julia, Stata, > Mathematica, and Scala. Note that R and Python have two interfaces. I've > used RStan, and it's pretty nice and pretty extensive. CmdStanR seems much > simpler in capability and in maintenance requirements, so a CmdStanJ seems > like a nice way to get sophisticated Bayesian regression analysis. Oh, and > RStan is GPL-3 while CmdStanR and Stan are BSD-3. > > I lack the immediate skills and the time to develop and use those skills. > Anyone else interested? > > Bill > -- > Bill Harris > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm