(j3.2006) Coindexed scalars, etc.

Bill Long longb
Mon Jan 19 17:50:11 UTC 2009



Whitlock, Stan wrote:
> I agree that co-indexed scalars should be allowed.  I expected them to be there already and was disappointed to see that they weren't.  Scalars are just rank-0 arrays, dudes!  Don't forget your APL.
>
> Now about fields at co-indexed objects, does C(J)[p] mean "go get all of C from p and find element J" or does it mean "go to p, get C(J), and bring it back".  I thought it meant the second.
>   

C(J)[p] means element J of array C on image p.  If it is part of an 
expression, the natural implementation is your second option above.   If 
it is the variable in an assignment, then it means 'send the value of 
the rhs to image p and stick it in element J of array C'.
> So that means that C(J)%X[p] is correct, ie, just "get field X from C(I) on p".
>   

Only if I = J.  :)

> It gets weird when we throw in substrings and %RE and %IM:  C(J)%L(J:K)[p] says "get just the J:K substring from C(J)%L on p".  I'd prefer C(J)%L[p](J:K) so the substringing happens after you get C(J)%L from p.
>
> Same with C(J)%Z%RE[p]  - you have to get just the real part of C(J)%Z from p.  I'd prefer splitting my complex numbers on my process after I get it from the other process, ie, C(J)%Z[p]%RE.
>   

The syntax for complex parts is <designator>%RE or %IM.  (See 
[121:6-7].)   The [ ] should be part of the <designator> (that's what 
we're trying to fix here), so what you prefer is already the syntax 
specified in 09-007.  It seems simpler to leave it that way, as we're 
past the point of changing things that are not technically wrong.


> This question also affects type kind and length parameters for parameterized derived types:
>     TYPE A
>         INTEGER, KIND :: K
>         INTEGER            :: S
>         COMPLEX (KIND = K) :: Z
>         CHARACTER (LEN = S) :: L
>     END TYPE A
>     TYPE (A (4, 9)) :: C (5) [4]
>
> I think that syntax is correct - if not, you know what I want to say:
>   

Which is  C(5)[*].
>     What is C (J)%Z%RE%KIND[p] ? 

Again, I think the %RE has to be at the end.
>  C(J)%L%LEN[p]?  They're 4 and 9, of course, since the TYPE (A (4, 9)) :: C (5) [4] declaration happens on all processors.  But what if the 9 were an X?  Does X have to have the same value on all processes?
>   

Yes. [36:4-5] says that corresponding coarrays have the same type 
parameters on all images.


> We could just simplify this discussion and not allow the type parameters and %RE, %IM, %KIND, and %LEN in the co-indexed object name?
>
> Did I mention that coarrays are getting uglier, the more we polish F2008?
>   

Though one could argue that the ugliness comes from the already existing 
ugliness of the warts we're trying to integrating coarrays into.

Cheers,
Bill


> Sigh!				/Stan
>
> -----Original Message-----
> From: j3-bounces at j3-fortran.org [mailto:j3-bounces at j3-fortran.org] On Behalf Of Aleksandar Donev
> Sent: Saturday, January 17, 2009 11:35 AM
> To: fortran standards email list for J3
> Subject: Re: (j3.2006) Coindexed scalars, etc.
>
> Hello,
> I think the [] should always go at the end, after all the local
> selectors, including substrings, so I vote for c(i)(l:r)[p]. For %Re and
> %Im I agree that they should be treated as components.
> Aleks
>
> Van Snyder wrote:
>   
>> Assuming we want coindexed scalars, substrings and complex part
>> designators, where do we want to put the image selector?  For a scalar
>> it's obvious.  For complex part designators, I think we want them before
>> %RE or %IM, as if they were components.
>>
>> For substrings it's not obvious.  Do we want C(i)[p](l:r) or
>> c(i)(l:r)[p]?  It's a little bit weird to put the image selector in the
>> middle.  OTOH, by putting it there, we can use <data-ref> to grab the
>> constraints on <image-selector>.  Perhaps <part-ref> should have been
>> <part-name> [<image-selector>] [(<section-subscript-list)] -- but this
>> would break existing implementations.
>>
>> Malcolm's message yesterday didn't edit the productions for substrings.
>>
>> The suggestion here replaces <object-name> in R601 instead of adding
>> <coindexed-named-object>.
>>
>> I believe the following covers coindexed scalars, coindexed complex
>> parts, coindexed type parameter inquiries, and coindexed substrings.
>> Adding coindexed whole arrays is trivial (just remove the proposed
>> constraint C600a).
>>
>> R601 <designator> <<is>> <non-substring-designator>
>>                   <<or>> <substring>
>>
>> R601a <non-substring-designator> <<is>> <data-ref>
>>                                  <<or>> <array-element>
>>                                  <<or>> <array-section>
>>                                  <<or>> <complex-part-designator>
>>                                  <<or>> <structure-component>
>>
>> C600 (R601a) A <section-subscript-list> shall not appear in <data-ref>.
>> {This blocks C624 from the general case.  We don't need to say "exactly
>> one <part-ref>" because the constraint on <structure-component> says
>> "more than one".}
>>
>> C600a (R601a) The <data-ref> shall be scalar if an <image-selector>
>>       appears.
>>       {I believe this constraint is harmful.}
>>
>> R609 <parent-string> <<is>> <scalar-non-substring-designator>
>>                      <<or>> <scalar-constant>
>>
>>
>> _______________________________________________
>> J3 mailing list
>> J3 at j3-fortran.org
>> http:// j3-fortran.org/mailman/listinfo/j3
>>
>>     
>
>
> --
> Aleksandar Donev, Ph.D.
> Lawrence Postdoctoral Fellow @ LLNL
> High Performance Computational Materials Science and Chemistry
> E-mail: donev1 at llnl.gov
> Phone: (925) 424-6816  Fax: (925) 423-0785
> Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
> Web: http://cherrypit.princeton.edu/donev
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
>
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
>   

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            




More information about the J3 mailing list