unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: John Cowan <cowan@ccil.org>
To: Daniel Llorens <daniel.llorens@bluewin.ch>
Cc: guile-user <guile-user@gnu.org>, Matt Wette <matt.wette@gmail.com>
Subject: Re: Matrix or array operations library
Date: Fri, 28 Dec 2018 18:16:02 -0500	[thread overview]
Message-ID: <CAD2gp_QNTymH4d8nVJ4s5Jzc61YjCLHDy=tyiJ_rpAwCbJTOyw@mail.gmail.com> (raw)
In-Reply-To: <1C6C55C9-24B1-4952-BC1A-18CF80749565@bluewin.ch>

On Fri, Dec 28, 2018 at 4:34 PM Daniel Llorens <daniel.llorens@bluewin.ch>
wrote:

Of course all those other languages have extensive (and more or less
> consistent) array facilities, while base Guile only has make-shared-array
> (and transpose-array, for some reason).


If array objects don't have an offset (the index in the backing store of
the [0,0, ... 0] element), you can't do arbitrary translations,
unfortunately.  If Guile doesn't have that, it should.


> For what is worth I think the array type needs to be moved to Scheme, but
> this should be done in a backwards compatible way.


Layering a Guile compatibility mode over SRFI 122 might be a Good Thing.
Arrays there allow arbitrary affine transformations of the indices, provide
lazy elementwise mapping (you can get eager mapping by composing mapping
with copying), and have fast paths for arrays of up to 4 dimensions.
Read-only and read-write arrays defined by arbitrary getter and setter
functions are also provided, and work exactly like storage-based arrays.
SRFI 122's only major limitation, which IMO is not a serious one, is that
it doesn't handle 0-dimensional arrays (with one element) or degenerate
arrays with non-positive dimensional ranges (with zero elements).  The code
is in Gambit Scheme, but translating it to portable Scheme is an easy
matter (I just haven't gotten around to it).  The main Gambit-specific
dependency is define-macro (non-hygienic) macros, but nothing very bad is
done with them.

There is a post-SRFI fork at https://github.com/gambiteer/srfi-122/ which
will fairly soon become an updated SRFI.

-- 
John Cowan          http://vrici.lojban.org/~cowan        cowan@ccil.org
Yakka foob mog.  Grug pubbawup zink wattoom gazork.  Chumble spuzz.
    --Calvin, giving Newton's First Law "in his own words"


  reply	other threads:[~2018-12-28 23:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
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] <mailman.73.1545757221.8862.guile-user@gnu.org>
2018-12-26 11:38 ` Zelphir Kaltstahl
2018-12-27 14:20   ` Matt Wette
2018-12-27 14:38     ` Mike Gran
     [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='CAD2gp_QNTymH4d8nVJ4s5Jzc61YjCLHDy=tyiJ_rpAwCbJTOyw@mail.gmail.com' \
    --to=cowan@ccil.org \
    --cc=daniel.llorens@bluewin.ch \
    --cc=guile-user@gnu.org \
    --cc=matt.wette@gmail.com \
    /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).