This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: pr32512 - efficiency of RESHAPE and SPREAD
- From: "Janne Blomqvist" <blomqvist dot janne at gmail dot com>
- To: "Paul Thomas" <paulthomas2 at wanadoo dot fr>
- Cc: "Fortran List" <fortran at gcc dot gnu dot org>, highegg at gmail dot com
- Date: Tue, 14 Aug 2007 16:44:47 +0300
- Subject: Re: pr32512 - efficiency of RESHAPE and SPREAD
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S1GTLkUmbaJ1Y2DNvcUn/qc11zUzjUsswqJQtw9ixLK+HBm7ZHPUoqo+4E4nblbKGSDAv4XI1LA8Wax4KESEsuFh7upwEDclxYXF6wqDY6iGMCtxHYRd0p8wIO2o7G7WzTK+Ygewd+frJArp3PIjnxIpfqr6BXcTGEUTIoUt0T4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=IlGkXquYWthEaZhDwJ24aMNNVa3hmbe79Nz0nfHqL0kDs3z9bzjbWlZCE81s2c3nSVOg2nMVonL3W/q8Gtvlik3Ln4RJS+UGWd3ChLp7PLKLv3DBAE8j76Zc8b9UFyAgVfJnBel0z2BZHlF5Dzwly4ZAGn8xDpyY/MWH3SqjK54=
- References: <46C0C059.7080402@wanadoo.fr>
On 8/13/07, Paul Thomas <paulthomas2@wanadoo.fr> wrote:
> Dear All,
>
> In contemplating this excellent suggestion from Jaroslav Hajek, I have
> run into an interesting puzzle.
>
> trans-array.c (gfc_conv_array_transpose) implements a transpose in which
> the operation is entirely performed inline and only acts on the
> descriptor. Jaroslav suggests that we do the same for reshape and spread.
>
> In investigating this, I found the rather wierd and wonderful property
> of gfortran; gfc_conv_array_transpose only works when it is the actual
> argument of something. If I lift this constraint, it still works fine.
>
> Does anybody know why this is so?
The standard say that arrays must be stored in column-major order
(F2003 6.2.2.2, Array element order)? But perhaps we can cheat anyways
and do
b = transpose (a)
by descriptor manipulation if b is a local variable which is not used
as an actual argument, not used in any way that requires sequence
association etc.
--
Janne Blomqvist