How do I use GSL in Julia? - julia

the general questiĆ³n would be how do I to use any library non-standar in Julia, e.g. libraries exported from C, specifically I downloaded the GNU Scientific Library from https://www.gnu.org/software/gsl/, according the Julia Manual I think it can be used, but I readed the INSTALL file from the GSL folder and I tried follow the steps, however I could not finish them because I did'nt understand some steps.
If anyone could give me some advice to use this library in Julia, I would appreciate it very much.
some details.
-OS: Windows10
-Julia version: 0.6

In the general case,
calling compiled code is done using ccall
For the case of GSL, for most operations you shouldn't be using GSL.
The (almost all) the functionality provided by GSL is well covered by the Julia standard library or by well maintained julia packages.
Mostly with implementation in pure julia.
Pure julia implementations will normally be basically as fast as the C/Fortran implementations.
Plus they will have other good features like working well with the optimiser,
and supporting custom types via multiple dispatch
For example supporting Dual numbers means that ForwardDiff.jl will just natively allow Auto differentiation to work with them.
For some code ducktyping will even let them work with things like TensorFlow..
As to how to install GSL, I think that is a seperate question from how to use GSL with julia.
Conviently though, if you are in a position you absolutely need to call GSL from julia,
there is already a julia package wrapping it. GSL.jl
And particularly conveniently, it will automatically download and install GSL for you when you run Pkg.add("GSL.jl"),
so you don't have to worry about installing it yourself.
If the package isn't working for you, raise an issue on their repo.
(Julia packages tend to be good like that, just installing all their dependencies so you don't have to fiddle around with things. I've been really impressed a few times when colleges have come to me saying "I love R library Foo but I can't using it on windows as I can't get the Fortran backend to work"; and I'll be like "Foo.jl does the same thing using the same fortran backend, also it automatically installs that backend, and does so in a way that just works even on windows.")

Related

Is there an official approach for implementing a plugin system in an R package?

Python has a few officially recognized approaches for developing a plugin system for your python module, which are described in the Python documentation for creating and discovering plugins.
For example, one way is to use package metadata to declare a plugin package as a plugin; then in the host package, you search through all installed python packages for those that have declared themselves as a plugin in the way you expect.
I suppose you could do something similar with package names; for example, say I have package MyRPackage and I want to develop a plugin system. I could use installed.packages to search for any package named MyRPackage_plugin_xyz, where xyz is the name of the plugin, and then use functions of a specified name in those packages to execute at certain point in MyRPackage.
So, it can be done -- my question is, does R provide specific official way to do this? Or, are there any packages that provide such capability?

Frama-C Value Builtins

I just built installed from the Opam package manager, and am trying to learn how to use value analysis from the tutorial on the frama-c website. I'm currently unable to use the builtin.c file, it's not in my share folder and I cannot figure out how to use -val-builtin (if that's even appropriate).
Any ideas on how to get this going?
I installed the 20151002 release of Frama-c.
Thanks for the help!!
Frama-C "semi-builtins" such as Frama_C_interval no longer need an implementation to be analyzed by Value. Hence, most of builtin.c has been removed, and the rest has been inlined in other files. All mentions of builtin.c in the manual can be ignored, provided __fc_builtin.h is included instead. Similarly, builtin.h has been replaced by __fc_builtin.h. (But a warning is emitted to make the user aware of this fact.) We will update the manuals for Frama-C Aluminium to clarify this.
Regarding which version should be used, I strongly advise you to use Magnesium (20151002). There have been quite a few improvements through the years.

Using Gradle with R project

I am beginning work on a project that makes heavy use of R. I've used R in the past, but only in a casual mode, whereas I'm now interested in following a more rigid practice of test/source control/continuous integration. I'm hoping to use Gradle with this project if possible, but I can't find any evidence that it is possible to use Gradle with R. Is it possible to create an R project with Gradle, and if so, where can I find steps to help me get started?
There appears to be a third-party plugin (https://github.com/jamiefolson/gradle-plugin-r). Alternatively, if R provides some command-line tools or Ant tasks, you can call into them from Gradle.
We have been working on gradle-R-plugin. (link to source is here https://github.com/arekbee/gradle-R-plugin). We have used it for CI/CD with TeamCity. gradle-R-plugin is base on devtools R package. I am happy to help you with this plugin.

Using Maven for R projects

I am beginning work on a project that makes heavy use of R. I've used R in the past, but only in a casual mode, whereas I'm now interested in following a more rigid practice of test/source control/continuous integration. I'm hoping to use Maven with this project if possible (having been pleased with how this manages packages with Java), but I can't find any evidence that it is possible to use Maven with R. Is it possible to create an R project with Maven, and if so, where can I find steps to help me get started?
I've found this question and this question, but they don't mention R.
Well you could make use of the Maven Exec Plugin with the resource, filter and jar plugins to fake an R project type.
You can do something like this to set up multiple R goals with the exec plugin so that compile, filter, test, et al have some kind of R call associated.
http://maven.apache.org/plugins/maven-resources-plugin/

Rcpp upgrading legacy code questions

I am taking over a project which involves upgrading to the latest version of Rcpp and thus I have to upgrade all the old style API calls (which is compatible with the CLassic version I believe). As there is no full API documentation, I am having to do this by trial and error and noting any "undefined reference" errors on linking and then looking through the vignettes/examples. The compile works fine but the errors arise on linking against \inst\libs\RLink.dll. I have manged to convert a lot of the code (mainly using Rcpp::List to extract and pack incoming and outgoing function parameters) but I simply cannot get equivalents for the following:
Rprintf or Rf_error and forward_exception_to_r.
R_NilValue
Rf_install
I am using Code::Blocks 10.05 IDE with RTools installed and Mingw64 referenced explicitly in the toolchain with the GNU GCC Compiler selected. I'd be grateful for any heads up. Thanks.
edit:
I do have #include and before that and (there was a series of errors that were occuring because I had included iostream before Rcpp, which was strange.
Can you please provide some concrete examples, maybe even on the rcpp-devel list? The porting approach works, I too have ported legacy code from the 'classic' Rcpp API, and so have others on the list.
But you do not have to port. The short vignette in the RcppClassic package has details on how to use it in case you want to maintain the old API.

Resources