This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pr32512 - efficiency of RESHAPE and SPREAD


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]