[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: Valentin Kamyshenko <val@kamysh.materials.kiev.ua>*Subject*: Re: Guile numerical work and uniform arrays*From*: Per Bothner <bothner@cygnus.com>*Date*: Sat, 07 Nov 1998 09:41:58 -0800*cc*: guile@cygnus.com*In-reply-to*: Your message of "07 Nov 1998 05:03:46 +0200." <m2pvb0dx0t.fsf@kamysh.materials.kiev.ua>*Message-Id*: <199811071741.JAA01921@cygnus.com>*Sender*: owner-guile@cygnus.com

> My impression is that there is also an array of pointers to one-dim > D-arrays. I would hope not! > Otherwise, I think, it would be impossible to work with shared arrays. Er, no. A shared array is (or should be) a pointer to a one-dimensional base array, plus a descriptor (containing offset from the start of the base vector, plus length and stride of each dimension). The descriptor defines a linear transformation of the array indexes into an index into the base array. For generality, it makes sense that non-shared multi-dimensional arrays should also be represented using a base vector (one-dimensional array) plus descriptor. It is then easy and cheap to perform various interesting transformations on (shared) arrays. > My suggestion was, thus: 1) to give user the possibility > to know that a given multi-dimensional array can be treated as > one-dimensional; 2) to have a standard procedure to get a pointer to > this chunk. I cannot see how this can be mathematically meaningful, in general, nor do I see any use for it (except perhaps some optionization). There are two "obvious" way to view a multi-dimensional array as a one-dimensional array: (1) As a vector of arrays. E.g. an array of shape (3, 4, 5) may be reasonably interpreted as a vector of size 3, each of whose elements has shape (4, 5). (Of course you can use some other dimension, but it is most natural to select the first dimension as primary - unless you're a Fortran programmer!) (2) In row-major-order (or I guess as column-major-order, if you're a Fortran programmer). This is sometims useful; unfortunately, there is no linear transformation that maps a general (shared) multi-dimensional array into a one-dimensional array such that can be described using a single stride per dimension. The (important) exception is the case of simple multi-dimensional arrays (with no offsetting relative to a base vector). In other cases, you need a more general (non-linear) mapping function. --Per Bothner Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner

**Follow-Ups**:**Re: Guile numerical work and uniform arrays***From:*Valentin Kamyshenko <val@kamysh.materials.kiev.ua>

**References**:**Re: Guile numerical work and uniform arrays***From:*Valentin Kamyshenko <val@kamysh.materials.kiev.ua>

- Prev by Date:
**Re: gc notes available** - Next by Date:
**Re: tiny-clos-questions** - Prev by thread:
**Re: Guile numerical work and uniform arrays** - Next by thread:
**Re: Guile numerical work and uniform arrays** - Index(es):