Scientific computing in D

Laeeth Isharc via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 10 19:29:55 PST 2015


On Monday, 9 November 2015 at 19:31:14 UTC, Márcio Martins wrote:
> I have been running some MCMC simulations in Python and it's 
> hard to cope with how unbelievably slow it is.
> Takes me almost a minute to run a few hundred thousand samples 
> on my laptop whereas I can run the same simulation with a 
> million samples in under 100ms, on my phone with JavaScript on 
> a browser.
>
> Then, you spend a minute waiting for the simulation to finish, 
> to find out you had an error in your report code that would 
> have been easily caught with static typing. So annoying...
>
> Is anyone doing similar stuff with D? Unfortunately, I couldn't 
> find any plotting libraries nor MATLAB-like numerical/stats 
> libs in dub.

dlangscience has some energy and people behind it.  John Colvin 
is heavily involved with it, but it's a joint project, and there 
are others too.  He wrote a draft white paper really thinking 
through the best design approach, and that will pay dividends 
over time, but in the meantime it's a central point for different 
scientific computing libraries.

plotting is a work in progress, I think.  there are some options. 
  for my stuff, it's not particularly clever so I use the D 
bindings to mathgl (a nice and simple C library), but depending 
on what you want to do, other choices may be more suitable.

it's pretty easy to call python libraries from D, and I have done 
that initially for plotting using bokeh.  the only problem was 
for callbacks that then meant potentially dealing with javascript 
as well, and I drew the line at three languages for such a simple 
thing.

> This seems like another area where D could easily pick up 
> momentum with RDMD and perhaps an integration with Jupyter 
> which is becoming very very popular.

Actually John Colvin has written an extension called pydmagic 
that allows you to write D code within a Jupyter notebook - it 
integrates with PyD so you can call D from python and call python 
from D (even embedded as a string if you like).  It's not yet 
highly-polished, but it works, and I have used it to get work 
done.




More information about the Digitalmars-d mailing list