D-Link with R/MATLAB/Julia/SQL
John Colvin
john.loughran.colvin at gmail.com
Thu Dec 5 05:30:09 PST 2013
On Thursday, 5 December 2013 at 11:13:17 UTC, Siavash Babaei
wrote:
> Hi,
>
> I primarily work in statistical modelling of financial data
> (risk modelling). I am at a point when I need to think about
> developing applications in addition to data analysis and
> modelling.
> My primary concern is whether or not I can run/call-on
> programmes that I have written in R/MATLAB/Julia. Accessing a
> database is also a concern.
> Now, I know C++/Visual Studio can handle this but I would like
> something more reliable and exciting (!better!) and I would
> like to know if I am in the right place.
>
> Thank You
Anything that can be compiled to a library conforming to the
native C ABI can be called directly from D.
This is definitely possible with matlab code, you'd just have to
write a D declaration for the function you want to call.
Julia doesn't have static compilation yet, or an official C API
as far as I know, so you'd have to do some form of IPC. If you're
only calling a function once every so often you could probably
get away with communicating with files. I think Julia supports
pipes, which would be better but possibly more work. See
std.process
R has the .c and .call interfaces with relevant C headers. I
don't know of any D port. Your options:
a) port as much or as little as you need of the R headers to D.
b) write a tiny wrapper function in C for each R function you
need, along with a D declaration. Call the C wrapper from D.
TL;DR:
Matlab: Should work perfectly, almost works-out-of-the-box.
Julia: You have to ride the convenience/overhead tradeoff curve.
R: If you know how to use the .c or .call C interface then it
should be trivial to interface with D.
More information about the Digitalmars-d
mailing list