J3/07-103r1 Date: 15 February 2007 To: J3 From: Van Snyder / Dick Hendrickson Subject: Clause 13; Add CO_FINDLOC function References: J3/07-007 This adds the CO_FINDLOC function to clause 13; Page 349:4, after CO_COUNT, add CO_FINDLOC to table Insert: CO_FINDLOC (CO_ARRAY, VALUE, RESULT, TEAM [, BACK]) location of value in a co-array or CO_FINDLOC (CO_ARRAY, VALUE, RESULT [, BACK) Page 364:14+, insert CO_FINDLOC description: CO_FINDLOC (CO_ARRAY, VALUE, RESULT, TEAM [, BACK]) CO_FINDLOC (CO_ARRAY, VALUE, RESULT [, BACK]) Description. Determine the image indices of the first or last image, in image index order, having a value that matches VALUE, on a team of images. Class. Collective subroutine. Arguments. CO_ARRAY shall be a co-array compatible scalar or array of intrinsic type. It is an INTENT(IN) argument. VALUE shall be scalar and in type conformance with ARRAY, as specified in Table 7.3 for relational intrinsic operations (7.1.5.6.1). It is an INTENT(IN) argument. RESULT shall be of type integer and have the same shape as CO_ARRAY. It is an INTENT(OUT) argument. Case(i): RESULT is scalar. If the value of CO_ARRAY on some image of the team matches VALUE the image index of that image is assigned to RESULT; otherwise the value zero is assigned. Case(ii): RESULT is an array. If the value of an element of CO_ARRAY on some image of the team matches VALUE the image index of that image is assigned to the corresponding element of RESULT; otherwise the value zero is assigned. If both CO_ARRAY and VALUE are of type logical, the comparison is performed using .EQV.; otherwise, the comparison is performed using == (.EQ.). If the value of the comparison is true, CO_ARRAY or the element of CO_ARRAY matches VALUE. TEAM shall be a scalar of type IMAGE TEAM (13.8.3.7). It is an INTENT(IN) argument that specifies the team for which CO_FINDLOC is performed. If TEAM does not appear, the team consists of all images. BACK (optional) shall be a logical scalar. It is an INTENT(IN) argument. If more than one image has a value that matches VALUE, and BACK is absent or present with the value false, the smallest such image index is assigned. If BACK is present with the value true, the image whose index is returned is the largest such image index. Examples. If the number of images is four and CO_ARRAY is a scalar with the values 2, 4, 6, and 8 on the four different images, the value of RESULT after the statement CALL CO_FINDLOC (CO_ARRAY, 6 ) is 3 on all images. If the number of images is two and CO ARRAY is the array [1, 5, 6] on one image and [4, 1, 6] on the other image, the value of RESULT after the statement CALL CO_FINDLOC (CO_ARRAY, 1, RESULT) is [1, 2, 0] and the value after the statement CALL CO_FINDLOC (CO_ARRAY, 1, RESULT, .TRUE.) is [1, 2, 0].