(j3.2006) What do typical processors do?
Clune, Thomas L. GSFC-6101
thomas.l.clune
Wed Jul 19 14:04:05 EDT 2017
There actually are other circumstances in which one wants to transpose an array, but not conjugate the values. Perhaps not for purely mathematical reasons, but for locality reasons. E.g., in a spectral code one might have one operation that is friendly to unit stride in kx and the other for unit stride in ky.
But I suspect the real reason is simply that Fortran should preserve the usual mathematical meaning of the terms conjugate and transpose. There is another term for the combination, and it would be reasonable to request a new intrinsic that corresponds to it. (But probably would not get much priority.)
> On Jul 19, 2017, at 1:53 PM, Toon Moene <toon at moene.org> wrote:
>
> On 07/19/2017 01:00 AM, Van Snyder wrote:
>
>> Should I expect a processor to optimize
>>
>> C = matmul ( A, conjg(transpose(B)) )
>>
>> without making two or three temps, or should I write a matmul that has
>> options to do that, or use *GEMM?
>
> I think this answers the question for gfortran 6.4:
>
> toon at moene:~/src$ cat complextranspose.f90
> complex a(20,10), b(20,10), c(20,20)
> a = 1.5
> b = 9.2
> c = matmul(a, conjg(transpose(b)))
> print*, c
> end
> toon at moene:~/src$ gfortran -S -Warray-temporaries complextranspose.f90
> complextranspose.f90:4:14:
>
> c = matmul(a, conjg(transpose(b)))
> 1
> Warning: Creating array temporary at (1) [-Warray-temporaries]
> toon at moene:~/src$
> toon at moene:~/src$ gfortran -S -O3 -Warray-temporaries complextranspose.f90
> toon at moene:~/src$
>
> The *real* question is, though:
>
> Why doesn't transpose(<something complex>) *mean* conjg(transpose(<it>))
> ? I can't imagine someone wanting anything else ...
> [ I wasn't a member yet when this was argued about for Fortran 90 ]
>
> Kind regards,
>
> --
> Toon Moene - e-mail: toon at moene.org - phone: +31 346 214290
> Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
> At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
> Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
More information about the J3
mailing list