[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Integrate Guile with GNU Scientific Library
From: |
Todor Kondić |
Subject: |
Re: Integrate Guile with GNU Scientific Library |
Date: |
Fri, 04 Oct 2019 14:32:16 +0000 |
On 4 Oct 2019, 03:10, Matt Wette < address@hidden> wrote:
On 10/3/19 12:28 AM, Freeduck via General Guile related discussions wrote:
> Hi All,
>
> I am trying to integrate Guile with a part of GNU Scientific Library and have
> found SWIG, which seems very easy to use, but only supports Guile 2.0. I have
> Guile 2.2 installed.
> The Guile homepage has a tutorial on integrating Guile into C, and the manual
> has a section on dynamic ffi, but it I find it hard to get started, maybe it
> is just lack of experience.
>
> My main problem is not integrating with GSL, but doing polynomial regression.
> I have been working in Racket for a while which has allot of maths
> integrated. Is there something like numpy/scipy for Guile.
>
> Kind regards
>
> Kristian
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
The FFI Helper in nyacc (https://savannah.nongnu.org/projects/nyacc)
provides the functionality of swig. You can try that. I'd be
interested in how you like that compared to swig.
A quick hack to see if I could get it to work for gsl failed:
$ cat gsl-sort.ffi
(define-ffi-module (gsl-sort)
#:pkg-config "gsl"
#:include '("gsl/gsl_sort.h"))
$ guild compile-ffi gsl-sort.ffi
...
ERROR: In procedure dynamic-link:
In procedure dynamic-link: file: "libm", message: "file not found"
So for some reason the linker is not finding libm.so on my Unbuntu.
I will need to look into that.
You can check the examples in examples/nyacc/lang/ffi-help.
First, sorry if I'm messing up bottom posting and formatting ... I'm responding
using a non-free mobile phone app :)
Second, the answer might be totally off-topic, but I always found it easier to
generate math programs by Guile and then compile them, then a full, seamless
library level integration into a Guile program itself. See, e.g.
https://gitlab.com/codetk/schemetran
for a naive implementation of fortran wrappers and compiler helpers in Guile.
It is naive, but I managed to do a lot of sophisticated linear algebra with it.
Anyway, good luck :) .
T
PS also in mine previous experiences when trying to link stuff using ffi,
looking at the symbols in libraries directly helped.