unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: guile-user@gnu.org
Subject: Re: Matrix or array operations library
Date: Thu, 27 Dec 2018 06:20:10 -0800	[thread overview]
Message-ID: <f4651550-93a1-38e1-c22b-323914038a0b@gmail.com> (raw)
In-Reply-To: <0124a907-fd07-21dc-ba70-49a7ce4daf29@gmail.com>

On 12/26/18 3:38 AM, Zelphir Kaltstahl wrote:
> On 25.12.18 18:00, guile-user-request@gnu.org wrote:
>> IMO, Guile probably needs something like ndarray, the base for numpy,
>> if matrix operations are going to go anywhere.
>>
>> As far as using blas or others, I have developed a package for helping
>> to use the FFI API for C libraries.  It may be of interest to you.
>>
>> ffi-helper: https://www.nongnu.org/nyacc/ffi-help.html
>>
>> Matt
> Hi!
>
> Thanks for the link Matt. Now I have a bunch of questions :-)
>
> I started reading the guide you linked to. I've never done any FFI stuff
> in any programming language so far, so this is completely new territory
> for me.
>
> (Q1) Can you explain what the advantage of the method you linked to is,
> in comparison to doing something like
> https://www.gnu.org/software/guile/manual/html_node/Dynamic-FFI.html ?

The advantage of the FFI Helper is time.  It takes minutes to generate
a ffi-module and seconds to compile to Guile Scheme.  It takes
significantly more time to code by hand.  While coding by hand gets you
something that is probably more palatable, using the FH can cover more
ground.

> (Q2) What is that `guild` command in the guide? (sounds like guildhall
> another Guile project, but I forgot what that does)

"guild" is the Guile compiler.  Try "guild compile foo.scm".

> (Q3) How would I set everything up, so that I can follow the tutorial at
> https://www.nongnu.org/nyacc/ffi-help.html?

download and read the README

* the tarball repository:
     https://download.savannah.gnu.org/releases/nyacc/

* the git repository:
     git://git.savannah.nongnu.org/nyacc.git

> iirc NYACC is a minimalistic compiler that was mentioned here on the
> mailing list several times in the context of bootstrapping Guile.
> (Q4) How is NYACC connected to doing FFI?

  It takes a decent C parser to read the include files.

> (Q5) Do I need NYACC installed on my system to do the stuff in the
> tutorial you linked?

Yes

> I guess, since I don't know things about FFI in general (except that I
> somehow get to magically call functions of another programming
> language), things like NumPy are out of my league for now and I should
> start with simple learning examples, to get an understanding of how FFI
> usually works and what things one touches, when using FFI for a library
> in another language and how much understanding of how the library works
> one needs to have.
>
> With regard to NumPy, especially the stuff about the "strides" (whatever
> that is) in the data buffer of a NumPy array and how what changes when
> creating a view and changing indices (For example I cannot imagine a
> single reason, why the ordering of how one writes the indices would
> matter, except for human readability?) … If I need to keep track of that
> … Let's just say I dislike working on a low level with a lot of
> pointers, addresses and segfaults ; )
>
> (Q6) Maybe I do not need to pay attention to how NumPy does things,
> except for procedure names, since NumPy handles it and I am just calling
> its procedures somehow? That's what I would be hoping for.

I'm not sure what you are asking.  If you want to work now in Guile try
some of the other packages offered.  To implement numpy would take some
work and I think the concept could go farther in Guile (e.g., some sort
of lazy eval scheme that can optimize evaluation of multi-operand
expressions, who knows).

> Maybe those are a lot of questions and maybe most of them would be
> answered, if I ever did any FFI stuff before. If anyone knows a good
> tutorial on FFI in Guile that explains this stuff, that would be great
> too. Or maybe someone knows some easy-to-ffi library to try things with?
>
> Best regards,
>
> Zelphir
>
>




  reply	other threads:[~2018-12-27 14:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.73.1545757221.8862.guile-user@gnu.org>
2018-12-26 11:38 ` Re: Matrix or array operations library Zelphir Kaltstahl
2018-12-27 14:20   ` Matt Wette [this message]
2018-12-27 14:38     ` Mike Gran
2018-12-26 11:43 ` guile-user Digest, Vol 193, Issue 29 Zelphir Kaltstahl
2018-12-26 19:51   ` Tk
2018-12-28 14:17     ` Zelphir Kaltstahl
     [not found] <mailman.32929.1546007691.1283.guile-user@gnu.org>
2018-12-28 20:23 ` Matrix or array operations library Daniel Llorens
2018-12-28 23:16   ` John Cowan
2018-12-29  0:17     ` Daniel Llorens
2019-01-27 18:41       ` Matt Wette
2018-12-28 23:24   ` Matt Wette
     [not found] <mailman.108.1545930019.12294.guile-user@gnu.org>
2018-12-27 18:43 ` Daniel Llorens
2018-12-27 21:24   ` John Cowan
2018-12-27 22:24   ` Matt Wette
     [not found] <c2172031-a0a6-9dd3-6ceb-7b6d94648475@gmail.com>
2018-12-24 22:01 ` Zelphir Kaltstahl
2018-12-24 23:06   ` Tk
2018-12-25  0:21   ` Matt Wette
2018-12-25 17:12   ` David Pirotte
2019-06-02 21:44   ` Linas Vepstas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f4651550-93a1-38e1-c22b-323914038a0b@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).