unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Marius Vollmer <mvo@zagadka.de>
Subject: Re: doc make-shared-array
Date: Mon, 28 Feb 2005 03:25:58 +0100	[thread overview]
Message-ID: <874qfxfmix.fsf@zagadka.de> (raw)
In-Reply-To: <87r7jmycar.fsf@zip.com.au> (Kevin Ryde's message of "Sat, 12 Feb 2005 09:14:20 +1100")

Kevin Ryde <user42@zip.com.au> writes:

> Expanded words about make-shared-array, trying to clarify what linear
> means, and adding lots of example usages.

Nice, thanks!

> [...] and perhaps enclose-array too (if anyone can explain what it
> actually does :-).

Yeah, strange critters, those enclosed arrays.  Enclosing an array is
like creating a new array where each element is a shared array created
from the original array.  An enclosed array is different from this in
that the shared arrays are created 'on-demand' during array-ref.

> The quotient/remainder example flattening two dims to one works I
> think, but I'm not sure it obeys a strict reading of what's described
> for a "linear" mapfunc.

It is not linear (and not affine) and make-shared array only works by
accident in this case, I think.  For example, bounds checking is not
done independently for each dimension, but only for the start and end
points in the lexical ordering of all possible indices, or something
like that.

Also, the map function is not really linear, it is affine (because of
the offset).

>      An array can be flattened from say two dimensions to one by having
>      the MAPFUNC translate portions of the new array to rows in the old,
>
>           (make-shared-array #2((a b c d) (e f g h) (i j k l))
>                              (lambda (i) (list (quotient i 4)
>                                                (remainder i 4)))
>                              12)
>           => #(a b c d e f g h i j k l)

This should be removed.  An array can be flattened with
array-contents.

>      The opposite is possible too, taking say a one dimensional array
>      and considering portions of it as rows,
>
>           (make-shared-array #1(a b c d e f g h i j k l)
>                              (lambda (i j) (list (+ (* i 3) j)))
>                              4 3)
>           => #2((a b c) (d e f) (g h i) (j k l))

But this is OK, of course.

>      With a negation on an index, the order that elements appear can be
>      reversed.  This is the sort of thing `array-transpose' below does.

Hmm, transpose-array (not array-transpose) permutes the indices, it
does not reverse the direction within one dimension.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


      reply	other threads:[~2005-02-28  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11 22:14 doc make-shared-array Kevin Ryde
2005-02-28  2:25 ` Marius Vollmer [this message]

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=874qfxfmix.fsf@zagadka.de \
    --to=mvo@zagadka.de \
    /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).