IMAGE_INDEX (The GNU Fortran Compiler)

### 8.156 `IMAGE_INDEX` — Function that converts a cosubscript to an image index ¶

Synopsis:

  `RESULT = IMAGE_INDEX(COARRAY, SUB)`

Description:

  Returns the image index belonging to a cosubscript.

Class:

  Inquiry function.

Arguments:

  COARRAY | Coarray of any type.
  SUB | default integer rank-1 array of a size equal to the corank of COARRAY.

Return value:

  Scalar default integer with the value of the image index that corresponds to the cosubscripts. For invalid cosubscripts the result is zero.

Example:

      INTEGER :: array[2,-1:4,8,*]
      ! Writes  28 (or 0 if there are fewer than 28 images)
      WRITE (*,*) IMAGE_INDEX (array, [2,0,3,1])

Standard:

  Fortran 2008 and later

See also:

  `THIS_IMAGE` — Function that returns the cosubscript index of this image,
  `NUM_IMAGES` — Function that returns the number of images