Intrinsic Procedures

Description of all intrinsic procedures, from FORTRAN 77 to Fortran 2023:

The procedure tables have the following form:

Syntax
Description Procedure Class Language Standard

Logical Functions

result = iand(i, j)

Returns the bitwise logical AND of i and j [integer, or BOZ constant since Fortran 2008].

elemental function Fortran 90, Fortran 2008
result = ior(i, j)

Returns the bitwise logical inclusive-OR of i and j [integer, or BOZ constant since Fortran 2008].

elemental function Fortran 90, Fortran 2008
result = ieor(i, j)

Returns the bitwise logical exclusive-OR of i and j [integer, or BOZ constant since Fortran 2008].

elemental function Fortran 90, Fortran 2008
result = not(i)

Returns the bitwise logical inverse of i [integer].

elemental function Fortran 90

Mathematical Functions

Power & Logarithmic Functions

result = exp(x)

Returns the base e exponential of x [real, complex].

elemental function FORTRAN 77
result = gamma(x)

Returns gamma of x [real], equals Γ(x) = (x − 1)!, with x > 0.

elemental function Fortran 2008
result = log(x)

The natural logarithm of x [real, complex] to the base e.

elemental function FORTRAN 77
result = log10(x)

The logarithm of x [real] to the base 10.

elemental function FORTRAN 77
result = log_gamma(x)

Returns the natural logarithm of the absolute value of the gamma function [real], with x > 0.

elemental function Fortran 2008
result = sqrt(x)

Returns the square root of x [real, complex].

elemental function FORTRAN 77

Trigonometric Functions

result = acos(x)

The arc cosine of x [real, complex since Fortran 2008].

elemental function FORTRAN 77, Fortran 2008
result = asin(x)

The arc sin of x [real, complex since Fortran 2008].

elemental function FORTRAN 77, Fortran 2008
result = atan(x)
result = atan(x, y)

The arc tangent of x [real], or single complex argument or two real arguments x, y since Fortran 2008.

elemental function FORTRAN 77, Fortran 2008
result = atan2(y, x)

The arc tangent of y, x [real] with respect to the correct quadrant.

elemental function FORTRAN 77
result = cos(x)

The cosine of x [real, complex].

elemental function FORTRAN 77
result = hypot(x, y)

Returns the Euclidean distance between x and y [real], i. e., sqrt(x**2 + y**2).

elemental function Fortran 2008
result = norm2(array[, dim])

Returns the Euclidean vector norm (L2 norm) of array [real] along optional dimension dim.

transformational function Fortran 2008
result = sin(x)

The sine of x [real, complex].

elemental function FORTRAN 77
result = tan(x)

The tangent of x [real, complex since Fortran 2008].

elemental function FORTRAN 77, Fortran 2008

Trigonometric Functions (Degrees)

result = acosd(x)

The arc cosine of x [real], expressed in degrees in the range 0 ≤ acosd(x) ≤ 180.

elemental function Fortran 2023
result = asind(x)

The arc sine of x [real], expressed in degrees in the range –90 ≤ asind(x) ≤ 90.

elemental function Fortran 2023
result = atand(x)
result = atand(y, x)

The arc tangent of x [real] or two real arguments x, y, expressed in degrees in the range –90 ≤ atand(x) ≤ 90.

elemental function Fortran 2023
result = atan2d(y, x)

The arc tangent of y, x [real] with respect to the correct quadrant. The result is expressed in degrees in the range –180 ≤ atan2d(y, x) ≤ 180.

elemental function Fortran 2023
result = cosd(x)

The cosine of x [real] in degrees.

elemental function Fortran 2023
result = sind(x)

The sine of x [real] in degrees.

elemental function Fortran 2023
result = tand(x)

The tangent of x [real] in degrees.

elemental function Fortran 2023

Trigonometric Functions (Half-Revolutions)

result = acospi(x)

The arc cosine of x [real], expressed in half-revolutions in the range 0 ≤ acospi(x) ≤ 1.

elemental function Fortran 2023
result = asinpi(x)

The arc sine of x [real], expressed in half-revolutions in the range –0.5 ≤ asinpi(x) ≤ 0.5.

elemental function Fortran 2023
result = atanpi(x)

The arc tangent of x [real], expressed in half-revolutions in the range –0.5 ≤ atanpi(x) ≤ 0.5.

elemental function Fortran 2023
result = atanpi(y, x)
result = atan2pi(y, x)

The arc tangent of y, x [real] with respect to the correct quadrant. The result is expressed in half-revolutions in the range –1 ≤ atan2pi(y, x) ≤ 1.

elemental function Fortran 2023
result = cospi(x)

The cosine of x [real] in half-revolutions.

elemental function Fortran 2023
result = sinpi(x)

The sine of x [real] in half-revolutions.

elemental function Fortran 2023
result = tanpi(x)

The tangent of x [real] in half-revolutions.

elemental function Fortran 2023

Hyperbolic Functions

result = acosh(x)

The inverse hyperbolic cosine of x [real, complex].

elemental function Fortran 2008
result = asinh(x)

The inverse hyperbolic sine of x [real, complex].

elemental function Fortran 2008
result = atanh(x)

The inverse hyperbolic tangent of x [real, complex].

elemental function Fortran 2008
result = cosh(x)

The hyperbolic cosine of x [real, complex since Fortran 2008].

elemental function FORTRAN 77, Fortran 2008
result = sinh(x)

The hyperbolic sine of x [real, complex since Fortran 2008].

elemental function Fortran 90, Fortran 2008
result = tanh(x)

The hyperbolic tangent of x [real, complex since Fortran 2008].

elemental function FORTRAN 77, Fortran 2008

Error Functions

result = erf(x)

Computes the error function of x [real]:

erf
elemental function Fortran 2008
result = erfc(x)

Computes the complementary error function of x [real]:

erfc
elemental function Fortran 2008
result = erfc_scaled(x)

Computes the exponentially-scaled complementary error function of x [real].

elemental function Fortran 2008

Bessel Functions

result = bessel_j0(x)

Computes the Bessel function of the first kind of order 0 of x [real]. The return value is of type real, lies in the range −0.4027… ≤ Bessel(0, x) ≤ 1, and has the same kind as x.

elemental function Fortran 2008
result = bessel_j1(x)

Computes the Bessel function of the first kind of order 1 of x [real]. The return value is of type real, lies in the range −0.5818… ≤ Bessel(0, x) ≤ 0.5818, and has the same kind as x.

elemental function Fortran 2008
result = bessel_jn(n, x)
result = bessel_jn(n1, n2, x)

The elemental function bessel_jn(n, x) computes the Bessel function of the first kind of order n [integer scalar or array] of x [real scalar or array]. If n and x are arrays, their ranks and shapes have to conform.

The transformational function bessel_jn(n1, n2, x) returns an array with the Bessel functions of the first kind of the orders n1 to n2 [integer, ≥ 0].

elemental function, transformational function Fortran 2008
result = bessel_y0(x)

Computes the Bessel function of the second kind of order 0 of x [real]. The return value is of type real and has the same kind as x.

elemental function Fortran 2008
result = bessel_y1(x)

Computes the Bessel function of the second kind of order 1 of x [real]. The return value is of type real and has the same kind as x.

elemental function Fortran 2008
result = bessel_yn(n, x)
result = bessel_yn(n1, n2, x)

The elemental function bessel_jn(n, x) computes the Bessel function of the second kind of order n [integer scalar or array] of x [real scalar or array]. If n and x are arrays, their ranks and shapes have to conform.

The transformational function bessel_jn(n1, n2, x) returns an array with the Bessel functions of the second kind of the orders n1 to n2 [integer, ≥ 0].

elemental function, transformational function Fortran 2008

Arithmetic Functions

result = abs(a)

Returns the absolute value of a [numeric].

elemental function FORTRAN 77
result = aimag(z)

Yields the imaginary part [real] of the argument z [complex]. The result has the kind parameter of the argument.

elemental function FORTRAN 77
result = aint(a[, kind])

Truncates the argument a [real] to a whole number [real], with optional real kind [integer] of the result.

elemental function FORTRAN 77
result = anint(a[, kind])

Rounds the argument a [real] to the nearest whole number [real], with optional kind parameter of the result.

elemental function FORTRAN 77
result = ceiling(a[, kind])

Returns the least integer greater than or equal to a [real], with optional integer kind [integer] of the result.

elemental function Fortran 95
result = conjg(z)

Returns the conjugate of z [complex]. If z is (x, y) then the result is (x, −y).

elemental function FORTRAN 77
result = digits(x)

Returns the number of significant binary digits of the internal model representation of x [integer, real].

inquiry function Fortran 90
result = dim(x, y)

Returns the difference x - y [integer, real] if the result is positive, otherwise returns zero

elemental function FORTRAN 77
result = dprod(x, y)

Returns the double product of x and y [real] as kind real(kind=real64), i. e., x * y.

elemental function FORTRAN 77
result = epsilon(x)

Returns the smallest number e of the same kind as x [real] such as that 1 + e > 1.

inquiry function Fortran 90
result = exponent(x)

Returns the value of the exponent part of x [real]. If x is zero, the value zero is returned.

elemental function Fortran 90
result = floor(a[, kind])

Returns the greatest integer less than or equal to a [real], with optional integer kind.

elemental function Fortran 95
result = fraction(x)

Returns the fractional part of the model representation of x [real].

elemental function Fortran 90
result = huge(x)

Returns the largest number that is not an infinity in the model of the type of a [real, integer].

inquiry function Fortran 90
result = maxexponent(x)

Returns the maximum exponent [integer] in the model of the type of x [real].

inquiry function Fortran 90
result = minexponent(x)

Returns the minimum exponent [integer] in the model of the type of x [real].

elemental function Fortran 90
result = nearest(x, s)

Returns the processor-representable number nearest to x [real] in the direction indicated by the sign of s [real, ≠ 0]. If s is positive, the routine returns a number greater than x and nearest to it; if s is negative, a number smaller than x and nearest to it instead.

elemental function Fortran 90
result = modulo(a, p)

Computes a [integer, real] modulo p [same type].

elemental function Fortran 95
result = nint(a, kind)

Returns argument a [real] rounded to the nearest whole number, with optional integer kind of the result since Fortran 90.

elemental function FORTRAN 77, Fortran 90
result = precision(x)

Returns the decimal precision in the model of the type of x [real, complex].

inquiry function Fortran 90
result = radix(x)

Returns the base of the model representing the entity x [integer, real].

inquiry function Fortran 90
result = range(x)

Returns the decimal exponent range in the model of the type of x [numeric].

inquiry function Fortran 90
result = rrspacing(x)

Returns the reciprocal of the relative spacing of model numbers near x [real]. The result is equal to abs(fraction(x)) * float(radix(x))**digits(x).

elemental function Fortran 90
result = scale(x, i)

Returns x * radix(x)**i, with x of type real and i of type integer.

elemental function Fortran 90
result = set_exponent(x, i)

Returns the real number whose fractional part is that of x [real] and whose exponent part is i [integer], i. e., fraction(x) * radix(x)**i.

elemental function Fortran 90
result = sign(a, b)

Returns the value of a with the sign of b [integer, real]. Since Fortran 2018, the arguments can be of different kind.

elemental function FORTRAN 77, Fortran 2018
result = spacing(x)

Returns the distance between x [real] and the nearest adjacent number of the same type.

elemental function Fortran 90
result = tiny(x)

Returns the smallest number that is not 0 in the model of the type of a [real, integer].

inquiry function Fortran 90

Bit Procedures

result = bge(i, j)

Returns .true. if i [integer] is bitwise greater than or equal to j [integer], else .false..

elemental function Fortran 2008
result = bgt(i, j)

Returns .true. if i [integer] is bitwise greater than j [integer], else .false..

elemental function Fortran 2008
result = ble(i, j)

Returns .true. if i [integer] is bitwise less than or equal to j [integer], else .false..

elemental function Fortran 2008
result = blt(i, j)

Returns .true. if i [integer] is bitwise less than j [integer], else .false..

elemental function Fortran 2008
result = btest(i, pos)

Returns .true. if the bit at position pos [integer] in i [integer] is set (test bit). The couting of the bits starts at 0.

elemental function Fortran 90
result = bit_size(i)

Returns the number of bits (integer precision plus sign bit) represented by the type of i [integer].

inquiry function Fortran 90
result = dshiftl(i, j, shift)

Combines bits of i and j [integer, BOZ constant). The rightmost shift [integer] bits of the result are the leftmost shift bits of j, and the remaining bits are the rightmost bits of i.

elemental function Fortran 2008
result = dshiftr(i, j, shift)

Combines bits of i and j [integer, BOZ constant). The leftmost shift [integer] bits of the result are the rightmost shift bits of i, and the remaining bits are the leftmost bits of j.

elemental function Fortran 2008
result = ibclr(i, pos)

Returns the value of i [integer] with the bit at position pos [integer] set to zero (clear bit).

elemental function Fortran 90
result = ibits(i, pos, len)

Extracts a field of length len [integer] from i [integer], starting from bit position pos [integer] and extending left for len bits (bit extraction). The result is right-justified and the remaining bits are set to zero. The value of pos + len must be ≤ bit_size(i).

elemental function Fortran 90
result = ibset(i, pos)

Returns the value of i [integer] with the bit at position pos set to one (set bit).

elemental function Fortran 90
result = ishft(i, shift)

Returns i [integer] with all bits shifted by shift [integer] places: left if shift > 0, right if shift < 0, and no shift if shift = 0. Zeros are shifted in from the opposite end.

elemental function Fortran 90
result = ishftc(i, shift[, size])

Returns a value corresponding to i [integer] with the rightmost size [integer] bits shifted circularly shift [integer] places; that is, bits shifted out one end are shifted into the opposite end.

A value of shift greater than zero corresponds to a left shift, a value of zero corresponds to no shift, and a value less than zero corresponds to a right shift.

The absolute value of SHIFT must be less than size. If the size argument is omitted, it is taken to be equivalent to bit_size(I).

elemental function Fortran 90
result = leadz(i)

Returns the number of leading zero bits of i [integer].

elemental function Fortran 2008
result = maskl(i[, kind])

Returns an integer that has its leftmost i [integer] bits set to 1, and the remaining bits set to 0, with optional integer kind [integer] of the result.

elemental function Fortran 2008
result = maskr(i[, kind])

Returns an integer that has its rightmost i [integer] bits set to 1, and the remaining bits set to 0, with optional integer kind [integer] of the result.

elemental function Fortran 2008
result = merge_bits(i, j, mask)

Merges the bit of i and j [integer] as determined by the mask mask [integer, BOZ constant).

elemental function Fortran 2008
call mvbits(from, frompos, len, to, topos)

Moves len [integer] bits from positions frompos [integer] through frompos + len - 1 of from [integer] to positions topos [integer] through topos + len - 1 of to [integer].

The values of frompos + len - 1 and topos + len - 1 must be less than bit_size(from).

elemental subroutine Fortran 90
result = popcnt(i)

Returns the number of bits set (i. e., 1 bits) in the binary representation of i [integer]

elemental function Fortran 2008
result = poppar(i)

Returns the parity of the number of bits set in i [integer], i. e., zero if i has an even number of bits set, and one for an odd number of bits set.

elemental function Fortran 2008
result = shifta(i, shift)

Returns i [integer] with all bits shifted right by shift [integer] places with fill. The fill is arithmetic: the bits shifted in from the left end are equal to the leftmost bit, which in two’s complement representation is the sign bit.

elemental function Fortran 2008
result = shiftl(i, shift)

Returns i [integer] with all bits shifted left by shift [integer] places.

elemental function Fortran 2008
result = shiftr(i, shift)

Returns i [integer] with all bits shifted right by shift [integer] places.

elemental function Fortran 2008
result = trailz(i)

Returns the number of trailing zero bits of i [integer].

elemental function Fortran 2008

Array Procedures

result = all(mask[, dim])

Determines if all the values in array mask [logical] are .true. along optional dimension dim [integer]. Returns .true. if all elements of mask are .true. or mask has zero size, else .false..

transformational function Fortran 90
result = any(mask[, dim])

Determines if any of the values in array mask [logical] are .true. along optional dimension dim [integer]. Returns .true. if any element of mask is .true., else .false..

transformational function Fortran 90
result = count(mask[, dim, kind])

Counts the number of .true. elements in mask [logical] along optional dimension dim [integer], and with optional logical kind [integer] of the result since Fortran 2003. If the array has zero size, or all of the elements are .false., then the result is 0.

transformational function Fortran 90, Fortran 2003
result = cshift(array, shift[, dim])

Performs a circular shift on elements of array along optional dimension dim [integer].

If the rank of array is one, then all elements are shifted by shift [integer] places. If rank is greater than one, then all complete rank one sections of array along the given dimension are shifted.

Elements shifted out one end of each rank one section are shifted back in the other end.

transformational function Fortran 90
result = eoshift(array, shift[, boundary, dim])

Performs an end-off shift on elements of array along optional dimension dim [integer].

If the rank of array is one, then all elements are shifted by shift [integer] places. If rank is greater than one, then all complete rank one sections of array along the given dimension are shifted.

Elements shifted out one end of each rank one section are dropped. If boundary [same type as array] is present then the corresponding value of from boundary is copied back in the other end. If boundary is not present then the following are copied in depending on the type of array.

transformational function Fortran 90
result = findloc(array, value, dim[, mask][, kind][, back])
result = findloc(array, value[, mask][, kind][, back])

Determines the location [integer] of the element in array [intrinsic] with the value given in the value [intrinsic] argument, or, if dim [integer] is supplied, determines the locations of the elements equal to value along each row of the array in the dim direction.

If mask [logical] is present, only the elements for which mask is .true. are considered. If more than one element in the array has the value value, the location returned is that of the first such element in array element order if back [logical] is not present or if it is .false..

If back is .true., the location returned is that of the last such element.

If the array has zero size, or all of the elements of mask are .false., then the result is an array of zeroes. Similarly, if dim is supplied and all of the elements of mask along a given row are zero, the result value for that row is zero.

transformational function Fortran 2008
result = iall(array[, mask])
result = iall(array, dim[, mask])

Bitwise AND of array elements [integer]. Reduces with bitwise AND the elements of array along dimension dim if the corresponding element in mask is .true..

transformational function Fortran 2008
result = iany(array[, mask])
result = iany(array, dim[, mask])

Bitwise inclusive-OR of array elements [integer]. Reduces with bitwise OR the elements of array along dimension dim if the corresponding element in mask is .true..

transformational function Fortran 2008
result = is_contiguous(array)

Returns .true. if the passed array is contiguous, else .false..

inquiry function Fortran 2008
result = lbound(array[, dim[, kind]])

Returns the lower bounds of array, or a single lower bound along the dim [integer] dimension, with optional integer kind [integer] of the result since Fortran 2003.

inquiry function Fortran 90, Fortran 2003
result = max(a1, a2 [, a3 [, …]])

Returns the argument [integer, real] with the largest value. The return value has the same type and kind as the first argument.

elemental function FORTRAN 77
result = maxloc(array, dim[, mask[, kind[, back]]])
result = maxloc(array[, mask][, kind][, back])

Determines the location of the element [integer] in array [integer or real, character since Fortran 2003] with the maximum value, or, if dim [integer] is supplied, determines the locations of the minimum element along each row of the array in the dim direction, with optional integer kind of the result since Fortran 2003.

If mask [logical] is present, only the elements for which mask is .true. are considered. If more than one element in the array has the minimum value, the location returned is that of the first such element in array element order if the optional back [logical, since Fortran 2008] argument is not present, or is .false.. If back is .true., the location returned is that of the last such element.

If the array has zero size, or all of the elements of mask are .false., then the result is an array of zeroes. Similarly, if dim is supplied and all of the elements of mask along a given row are zero, the result value for that row is zero.

transformational function Fortran 95, Fortran 2003, Fortran 2008
result = maxval(array, dim[, mask])
result = maxval(array[, mask])

Returns the maximum value of the elements in array [integer, real], or, if dim is supplied, determines the maximum value along each row of array in the dim direction.

If mask [logical] is present, only the elements for which mask is .true. are considered.

If array has zero size, or all of the elements of mask are .false., then the result is -huge(array) if array is numeric, or a string of nulls if array is of character type.

transformational function Fortran 90
result = merge(tsource, fsource[, mask])

Select values from two arrays according to a logical mask. The result is equal to tsource [any type] if mask [logical] is .true., or equal to fsource [same type as tsource] if it is .false..

elemental function Fortran 95
result = min(a1, a2 [, a3 [, …]])

Returns the argument [integer, real] with the smallest value. The return value has the same type and kind as the first argument.

elemental function FORTRAN 77
result = minloc(array, dim[, mask][, kind][, back])
result = minloc(array[, mask][, kind][, back])

Determines the location of the element [integer] in array [integer or real, character since Fortran 2003] with the minimum value, or, if dim [integer] is supplied, determines the locations of the minimum element along each row of the array in the dim direction, with optional integer kind of the result since Fortran 2003.

If mask [logical] is present, only the elements for which mask is .true. are considered. If more than one element in the array has the minimum value, the location returned is that of the first such element in array element order if the optional back [logical, since Fortran 2008] argument is not present, or is .false.. If back is .true., the location returned is that of the last such element.

If the array has zero size, or all of the elements of mask are .false., then the result is an array of zeroes. Similarly, if dim is supplied and all of the elements of mask along a given row are zero, the result value for that row is zero.

transformational function Fortran 90, Fortran 2003, Fortran 2008
result = minval(array, dim[, mask])
result = minval(array[, mask])

Returns the minimum value of the elements in array [integer, real], or, if dim is supplied, determines the minimum value along each row of array in the dim direction.

If mask [logical] is present, only the elements for which mask is .true. are considered.

If array has zero size, or all of the elements of mask are .false., then the result is huge(array) if array is numeric, or a string of char(255) if array is of character type.

transformational function Fortran 90
call move_alloc(from, to[, stat][, errmsg])

Moves the allocation from array from to array to. The array from will be deallocated. If an error occurs, the stat [integer] is given a non-zero value. An explanatory message is then return in errmsg [character].

pure subroutine Fortran 2003, Fortran 2018
result = pack(array, mask[, vector])

Stores the elements of array in an array of rank one.

The beginning of the resulting array is made up of elements whose mask [logical] equals .true.. Afterwards, positions are filled with elements taken from vector [same type as array].

transformational function Fortran 90
result = product(array[, mask])
result = product(array, dim[, mask])

Multiplies the elements of array [numeric] along dimension dim if the corresponding element in mask [logical] is .true..

transformational function Fortran 90
result = rank(a)

Returns the rank of a scalar or array data object a.

inquiry function Fortran 2008
result = reduce(array, operation[, mask][, identity][, ordered])
result = reduce(array, operation, dim[, mask][, identity][, ordered])

Performs a general array reduction of array [any type] using function operation, along optional dimension dim [integer] and optional mask array mask [logical].

The initial order of the sequence is array element order. While there is more than one element in the sequence, each iteration calculates r = operation(a, b) replacing a and b with r. If ordered [logical] is present with the value .true., a and b must be the first two elements of the sequence. The process continues until the sequence has one value, and that is the value of the reduction.

If array is a zero-sized array and identity [scalar of same type as array] is present, the result is the value of identity; otherwise error termination is initiated.

operation must be a pure function with two non-optional, scalar, non-allocatable, non-pointer, non-polymorphic dummy arguments with the same declared type and type-parameters as array. The function result must be non-polymorphic and scalar, with the same declared type and type parameters as array.

transformational function Fortran 2018
result = reshape(source, shape[, pad, order])

Reshapes array source to correspond to shape [integer array]. If necessary, the new array may be padded with elements from pad or permuted as defined by order [integer array].

transformational function Fortran 90
result = shape(source[, kind])

Determines the shape of array source, with optional integer kind of the result since Fortran 2003.

inquiry function Fortran 90, Fortran 2003
result = size(array[, dim[, kind]])

Determine the extent of array along a specified dimension dim, or the total number of elements in array if dim is absent, with optional integer kind of the result since Fortran 2003.

inquiry function Fortran 90, Fortran 2003
result = spread(source, dim, ncopies)

Replicates a source array of any type and rank ncopies [integer] times along a specified dimension dim [integer].

transformational function Fortran 90
result = sum(array[, mask])
result = sum(array, dim[, mask])

Adds the elements of array [numeric] along dimension dim if the corresponding element in mask [logical] is .true..

transformational function Fortran 90
result = ubound(array[, dim[, kind]])

Returns the upper bounds of array, or a single upper bound along the dim [integer] dimension, with optional integer kind [integer] of the result since Fortran 2003.

inquiry function Fortran 90, Fortran 2003
result = unpack(vector, mask, field)

Stores the elements of vector in an array of higher rank, with vector having at least as many elements as mask has .true. values. The resulting array corresponds to field with .true. elements of mask replaced by values from vector in array element order.

transformational function Fortran 90

Vector & Matrix Functions

result = dot_product(vector_a, vector_b)

Computes the dot product multiplication of two vectors vector_a and vector_b (both either numeric or logical].

transformational function Fortran 90
result = matmul(matrix_a, matrix_b)

Performs a matrix multiplication on numeric or logical arguments, with rank one or two.

transformational function Fortran 90
result = transpose(matrix)

Transposes array matrix of rank two. The result has the same type as matrix, and has shape [ m, n ] if matrix has shape [ n, m ].

transformational function Fortran 90

Character Functions

result = achar(i[, kind])

Returns the character located at position i in the ASCII collating sequence, with optional character kind kind since Fortran 2003.

elemental function FORTRAN 77, Fortran 2003
result = adjustl(string)

Left-adjust string [character] by removing leading spaces. Spaces are inserted at the end of the string as needed. The return value is of the same kind as string.

elemental function Fortran 90
result = adjustr(string)

Right-adjust string [character] by removing trailing spaces. Spaces are inserted at the start of the string as needed. The return value is of the same kind as string.

elemental function Fortran 90
result = iachar(c[, kind])

Returns the code for the ASCII character in the first character position of c [character], with optional integer kind of the result since Fortran 2003.

elemental function Fortran 95, Fortran 2003
result = index(string, substring[, back[, kind]])

Returns the position of the start of the first occurrence of substring [character] within string [character], with optional integer kind argument of the result since Fortran 2003 (counting from one).

If substring is not present in string, zero is returned. If the back argument [logical] is present and .true., the return value is the start of the last occurrence rather than the first.

elemental function FORTRAN 77, Fortran 2003
result = len(string[, kind])

Returns the length of string [character], with optional integer kind of the result since Fortran 2003. If string is an array, the length of an element is returned.

inquiry function FORTRAN 77, Fortran 2003
result = len_trim(string[, kind])

Returns the length of string [character], ignoring any trailing blanks, and with optional integer kind kind of the result since Fortran 2003.

elemental function Fortran 90, Fortran 2003
result = lge(string_a, string_b)

Returns .true. if string_a [character] is lexically greater than or equal to string_b [character], where the two strings are interpreted as containing ASCII character codes.

If string_a and string_b are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

elemental function FORTRAN 77
result = lgt(string_a, string_b)

Returns .true. if string_a [character] is lexically greater than string_b [character], where the two strings are interpreted as containing ASCII character codes.

If string_a and string_b are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

elemental function FORTRAN 77
result = lle(string_a, string_b)

Returns .true. if string_a [character] is lexically less than or equal to string_b [character], where the two strings are interpreted as containing ASCII character codes.

If string_a and string_b are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

elemental function FORTRAN 77
result = llt(string_a, string_b)

Returns .true. if string_a [character] is lexically less than string_b [character], where the two strings are interpreted as containing ASCII character codes.

If string_a and string_b are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

elemental function FORTRAN 77
result = new_line(c)

Returns the new-line character [character(len=1)] of the same kind as argument c [character], for example, print *, new_line('A').

inquiry function Fortran 2003
result = repeat(string, ncopies)

Concatenates ncopies [integer] of given string. The result is a new scalar of type character built up from ncopies copies of string.

transformational function Fortran 90
result = scan(string, set[, back[, kind]])

Scans a string [character] for any of the characters in a set of characters. If back [logical] is either absent or equals .false., this function returns the position of the leftmost character of string that is in set, else the rightmost position is returned.

If no character of set is found in string, the result is zero. The return value is of integer kind since Fortran 2003.

elemental function Fortran 90, Fortran 2003
call split(string, set, pos[, back])

Parses string [character] into tokens, one at a time. Each character in set [character] is a token delimiter.

Argument pos [integer] is assigned the position of the leftmost token delimiter in string whose position is greater than pos, or if there is no such character, it is assigned a value one greater than the length of string. This identifies a token with starting position one greater than the value of pos on invocation, and ending position one less than the value of pos on return.

If back [logical] is present and .true., pos is assigned the position of the rightmost token delimiter whose position is less than pos, or if there is no such character, it is assigned the value zero.

subroutine Fortran 2023
call tokenize(string, set, tokens[, separator])
call tokenize(string, set, first, last)

Parses string [character] into allocatable array tokens [character] of rank one with deferred length. It is allocated with the lower bound equal to one and the upper bound equal to the number of tokens in STRING, and with character length equal to the length of the longest token. Each character in set [character] is a token delimiter.

Optional argument separator [character] an allocatable array of rank one with deferred length. It is allocated with the lower bound equal to one and the upper bound equal to one less than the number of tokens in string, and with character length equal to one. Each element separator(i) is assigned the value of the i-th token delimiter in string.

Each element in array first [integer] is assigned the starting position of each token in string, in the order found. If a token has zero length, the starting position is equal to one if the token is at the beginning of string, and one greater than the position of the preceding delimiter otherwise.

Each element in array last [integer] is assigned the ending position of each token in string, in the order found. If a token has zero length, the ending position is one less than the starting position.

subroutine Fortran 2023
result = trim(string)

Removes trailing blank character of string.

transformational function Fortran 90
result = verify(string, set[, back[, kind]])

Verifies that all the characters in string belong to the set of characters in set, with optional integer kind argument of the result since Fortran 2003.

If back [logical] is either absent or equals .false., the function returns the position of the leftmost character of string that is not in set. If back equals .true., the rightmost position is returned. If all characters of string are found in set, the result is zero.

elemental function Fortran 90, Fortran 2003

Type & Kind Functions

result = allocated(array)
result = allocated(scalar)

Returns .true. if array or scalar (Fortran 2003) is allocated, else .false.. The argument must be allocatable.

inquiry function Fortran 90, Fortran 2003
result = associated(pointer[, target])

Returns .true. if pointer is associated or associated with target, else .false..

inquiry function Fortran 90
result = extends_type_of(a, mold)

Queries dynamic type for extension. Returns .true. if a is an extension of mold, else .false..

inquiry function Fortran 2003
result = is_iostat_end(i)

Returns .true. if argument i [integer] has the value of the I/O status “end of file”, else .false.. The function is equivalent to comparing the variable with the IOSTAT_END parameter of the intrinsic module iso_fortran_env.

elemental function Fortran 2003
result = is_iostat_eor(i)

Returns .true. if argument i [integer] has the value of the I/O status “end of record”, else .false.. The function is equivalent to comparing the variable with the IOSTAT_EOR parameter of the intrinsic module iso_fortran_env.

elemental function Fortran 2003
result = kind(x)

Returns the kind value of the entity x [logical, integer, real, complex, character, either scalar or array].

transformational function Fortran 95
result = next(a[, stat])

Returns the next enumeration value of a [enumeration]. If a is equal to the last enumerator of its type, stat [integer] is assigned a positive value, else 0.

inquiry function Fortran 2023
result = null([mold])

Returns a disassociated pointer. If mold is present, a disassociated pointer of the same type is returned, otherwise the type is determined by context. The argument mold may be required in Fortran 2003.

transformational function Fortran 95, Fortran 2003
result = out_of_range(x, mold[, round])

Returns .true. if the given argument scalar x [integer, real] can be safely converted to a different type and kind. If round [logical] is .true., x and mold can be of different types.

elemental function Fortran 2018
result = present(a)

Returns .true. if the given optional dummy argument of a function or subroutine is present, else .false..

inquiry function Fortran 90
result = previous(a[, stat])

Returns the previous enumeration value of a [enumeration]. If a is equal to the first enumerator of its type, stat [integer] is assigned a positive value, else 0.

inquiry function Fortran 2023
result = same_type_as(a, b)

Queries dynamic types for equality. Returns .true. if a is of the same type as b, else .false..

inquiry function Fortran 2003
result = selected_char_kind(name)

Returns the kind value [integer] for the character set named name [character], if a character set with such a name is supported, or −1 otherwise.

The character sets are compiler-depended, and may include ascii/default and ISO_10646 (Universal Character Set, UCS-4) that is equivalent to Unicode.

transformational function Fortran 2003
result = selected_int_kind(r)

Return the kind value [integer] of the smallest integer type that can represent all values ranging from −10r (exclusive) to 10r (exclusive) [integer].

If there is no integer kind that accommodates this range, the function returns −1.

transformational function Fortran 90
result = selected_logical_kind(bits)

Return the kind value [integer] of a logical type whose storage size in bits is at least bits [integer]. If no such type is available, the function returns −1. If there is more than one such kind, the one with smallest kind value from those with smallest storage size is chosen.

transformational function Fortran 2023
result = selected_real_kind([p, r, radix])

Returns the kind value [integer] of a real data type with decimal precision of at least p [integer] digits, exponent range of at least r [integer], and optionally with a radix of radix [integer] since Fortran 2008.

If the radix argument is absent, real kinds with any radix can be returned. If more than one real data type meet the criteria, the kind of the data type with the smallest decimal precision is returned. If no real data type matches the criteria, the result is < 0.

transformational function Fortran 90, Fortran 2008
result = storage_size(x[, kind])

Returns the storage size of argument a [scalar or array] in bits, with optional integer kind of the result.

elemental function Fortran 2008
result = transfer(source, mold[, size])

Interprets the bitwise representation of source in memory as if it is the representation of a variable or array of the same type and type parameters as mold.

This is approximately equivalent to the C concept of casting one type to another. The result has the same type as mold, with the bit level representation of source.

transformational function Fortran 90

Type Conversion Functions

result = char(c[, kind])

Returns the character represented by i [integer]. The return value is of type character(len=1), and optionally of character kind kind.

elemental function FORTRAN 77
result = cmplx(x[, y[, kind]])

Returns a complex number where x is converted to the real component. If y is present it is converted to the imaginary component, else it is set to 0.0. If x is complex then y must not be present.

elemental function FORTRAN 77
result = dble(a)

Converts a [numeric] to double precision real type.

elemental function FORTRAN 77
result = ichar(c[, kind])

Returns the code for the character in the first character position of c [character] in the system’s native character set, with optional integer kind of the result since Fortran 2003.

elemental function FORTRAN 77, Fortran 2003
result = int(a[, kind])

Converts a [numeric, BOZ constant since Fortran 2008] to integer type, with optional integer kind kind of the result since Fortran 2008.

elemental function FORTRAN 77, Fortran 2008
result = logical(l[, kind])

Converts l [logical] to other logical kind kind.

elemental function Fortran 90
result = real(a[, kind])

Converts a [numeric] to single precision real type, with optional real kind of the result since Fortran 90.

elemental function FORTRAN 77, Fortran 90

Random Number Procedures

call random_init(repeatable, image_distinct)

Initialises a pseudo-random number generator. If repeatable [logical] is .true., the seed is set to a processor-dependent value that is the same each time the subroutine is called from the same image. If image_distinct is .true., the seed is set to a processor-dependent value that is distinct from the seed set by a call to the subroutine in another image.

subroutine Fortran 2018
call random_number(harvest)

Returns a single pseudorandom number or an array of pseudorandom numbers from the uniform distribution over the range 0 ≤ x < 1 in scalar or array harvest [real]. In a multi-threaded program (e. g., OpenMP), each thread will have its own random number state.

subroutine Fortran 90
call random_seed([size, put, get])

Restarts or queries the state of the pseudo-random number generator used by random_number(). If the subroutine is called without arguments, it is seeded with random data retrieved from the operating system.

The optional argument size [integer] specifies the minimum size of the arrays used with the put and get arguments. The put [integer] argument sets the seed to the passed array, the get [integer] argument instead returns the seed as array.

subroutine Fortran 90

System Procedures

result = compiler_options()

Returns a string with the options used for compiling. The function has to be imported from module iso_fortran_env.

inquiry function Fortran 2008
result = compiler_version()

Returns a string with the name and the version of the compiler. The function has to be imported from module iso_fortran_env.

inquiry function Fortran 2008
result = command_argument_count()

Returns the number of arguments passed on the command-line as integer.

inquiry function Fortran 2003
call cpu_time(time)

Returns the elapsed CPU time in seconds in time [real]. If a time source is available, the time will be reported with microsecond resolution. If no time source is available, argument time is set to -1.0.

subroutine Fortran 95
call date_and_time(date, time, zone, values)

Returns the corresponding date and time information from the real-time system clock.

The argument date [character(len=8)] has the form ccyymmdd, argument time [character(len=10)] the form hhmmss.sss, argument zone [character(len=5)] the form (+-)hhmm, representing the difference with respect to Coordinated Universal Time (UTC).

The argument values(8) [integer(kind=int32), integer(kind=int64)] contains:

  • values(1): The year.
  • values(2): The month.
  • values(3): The day of the month.
  • values(4): Time difference with UTC in minutes.
  • values(5): The hour of the day.
  • values(6): The minutes of the hour.
  • values(7): The seconds of the minute.
  • values(8): The milliseconds of the second.
subroutine Fortran 90
call execute_command_line(command[, wait, exitstat, cmdstat, cmdmsg])

Runs a shell command command [character], synchronously (default) or asynchronously (if argument wait is .false.). After synchronous execution, exitstat [integer] contains the exit code of the command, as returned by system.

Argument cmdstat [integer] is set to zero if the command-line was executed (whatever its exit status was). cmdmsg [character] is assigned an error message if an error has occurred.

subroutine Fortran 2008
call get_command([command, length, status, errmsg])

Retrieves the entire command-line that was used to invoke the program. If command [character] is present, it stores the command-line. If length [integer] is present, it is assigned the length of the command-line.

If status [integer] is present, it is assigned 0 upon success of the command, −1 if command is too short to store the command-line, or a positive value in case of an error. The error message is returned in errmsg [character] (Fortran 2018).

subroutine Fortran 2003, Fortran 2018
call get_command_argument(number[, value, length, status, errmsg])

Retrieves the number-th argument that was passed on the command-line. Argument value [character] argument holds the command-line argument. If the argument cannot hold the argument, it is truncated to fit its length. If there are less than number [integer] arguments specified at the command line, value will be filled with blanks.

If number equals 0, value is set to the name of the program. The length [integer] argument contains the length of command-line argument.

If the argument retrieval fails, status is a positive number; if value contains a truncated command line argument, status [integer] is −1; and otherwise the status is zero. The error message is returned in errmsg [character] (Fortran 2018).

subroutine Fortran 2003, Fortran 2018
call get_environment_variable(name[, value, length, status, trim_name, errmsg])

Retrieves the value of the environmental variable name [both character]. If trim_name [logical] is present with the value .false., the trailing blanks in name are significant; otherwise they are not part of the environment variable name. The error message is returned in errmsg [character] (Fortran 2018).

The subroutine need not be thread-safe. It is the responsibility of the user to ensure that the environment is not being updated concurrently with a call to the subroutine.

subroutine Fortran 2003, Fortran 2018
call system_clock([count, count_rate, count_max])
Determines the count [integer] of a processor clock since an unspecified time in the past modulo count_max [integer]. Argument count_rate [integer] determines the number of clock ticks per second. If the platform supports a monotonic clock, that clock is used and can, depending on the platform clock implementation, provide up to nanosecond resolution. If a monotonic clock is not available, the implementation falls back to a real-time clock.

Argument count_rate is system-dependent and can vary depending on the kind of the arguments. For kind=int32 and smaller integer kind arguments, count represents milliseconds, while for kind=int64 and larger integer kind arguments, count typically represents micro- or nanoseconds depending on resolution of the underlying platform clock. Argument count_max usually equals huge(count_max).

If there is no clock, or querying the clock fails, count is set to -huge(count), and count_rate and count_max are set to zero.

It is recommended that all references to system_clock() use integer arguments with a decimal exponent range of at least 18. This lets the processor select the most accurate clock available while minimizing how often the count value resets to zero.

subroutine Fortran 90

ISO_C_BINDING Procedures

The intrinsic Fortran module iso_c_binding has to imported with use, intrinsic :: iso_c_binding first to access any of the following procedures.

result = c_associated(cptr1[, cptr2])

Returns .true. if the C pointer cptr1 [type(c_ptr)] is associated, or if cptr1 is associated with the target cptr2 [type(c_ptr)], else .false..

transformational function Fortran 2003
call c_f_pointer(cptr, fptr[, shape][, lower])

Assigns the target of the C pointer cptr [type(c_ptr)] to the Fortran pointer fptr [pointer], and optionally specifies its shape [integer array].

The optional argument lower (since Fortran 2023) is an array of rank one with the same size as the argument shape, and can be present only if shape is present. If present, it specifies the lower bounds of the pointer result, which otherwise all have the value 1.

subroutine Fortran 2003, Fortran 2023
call c_f_procpointer(cptr, fptr)

Assigns the target of the C function pointer cptr [type(c_funptr)] to the Fortran procedure pointer fptr [procedure].

subroutine Fortran 2003
call c_f_strpointer(cstrarray, fstrptr[, nchars])
call c_f_strpointer(cstrptr, fstrptr[, nchars])

Converts the rank one character array cstrarray [character(kind=c_char)] or the C character pointer cstrptr [type(c_ptr)] that holds the address to a contiguous array of nchars [integer] characters to a deferred-length character pointer fstrptr [character(kind=c_char), pointer].

The length type parameter of fstrptr becomes the largest value for which no C null characters appear in the sequence, and which is less than or equal to nchars if present, and the size of cstrarray otherwise.

subroutine Fortran 2023
result = c_funloc(x)

Determines the C address [type(c_funptr)] of procedure x [interoperable procedure, procedure pointer].

transformational function Fortran 2003
result = c_loc(x)

Determines the C address [type(c_ptr)] of variable x [interoperable type with pointer or target attribute].

transformational function Fortran 2003
result = c_sizeof(x)

Calculates the number of bytes of storage [integer(kind=c_size_t)] the expression x [interoperable type] occupies.

If x has the pointer attribute, the number of bytes of the storage area pointed to is returned. If the argument is of a derived type with pointer or allocatable components, the return value does not account for the sizes of the data pointed to by these components.

inquiry function Fortran 2008
result = f_c_string(string[, asis])

Returns a character scalar of the same type and kind as string [character(kind=c_char)] whose value is trim(string) // c_null_char. If asis [logical] is present and .true., the result is string // c_null_char.

transformational function Fortran 2023

Coarray Procedures

call atomic_add(atom, value[, stat])

Atomically adds value [scalar of the same type as atom] to the variable atom [integer(kind=atomic_int_kind), coarray or coindexed].

When stat [integer] is present and the invocation was successful, it is assigned the value 0, or a positive value if the invocation has failed.

In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE, and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call atomic_and(atom, value[, stat])

Atomically defines atom [integer(kind=atomic_int_kind), coarray or coindexed] with the bitwise AND between the values of atom and value [scalar of the same type as atom].

When stat [integer] is present and the invocation was successful, it is assigned the value 0, or a positive value if the invocation has failed.

In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call atomic_cas(atom, old, compare, new[, stat])

Compares the variable atom [integer(kind=atomic_int_kind) or logical(kind=atomic_logical_kind), scalar coarray or coindexed] with the value of compare. If the value is the same, atom is set to the value of new.

old is set to the value of atom that was used for the comparison.

When stat [integer] is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call atomic_define(atom, value[, stat])

Defines the variable atom [integer(kind=atomic_int_kind) or logical(kind=atomic_logical_kind), scalar coarray or coindexed] with the value value atomically.

When stat [integer (since Fortran 2018) is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2008, Fortran 2018
call atomic_fetch_add(atom, value, old[, stat])

Atomically stores the value of atom [integer(kind=atomic_int_kind) or logical(kind=atomic_logical_kind), scalar coarray or coindexed] in old and adds the value of var to the variable atom.

When stat [integer] is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call atomic_fetch_and(atom, value, old[, stat])

Atomically stores the value of atom [integer(kind=atomic_int_kind), scalar coarray or coindexed] in old and defines atom with the bitwise AND between the values of atom and value.

When stat [integer] is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call atomic_fetch_or(atom, value, old[, stat])

Atomically stores the value of atom [integer(kind=atomic_int_kind), scalar coarray or coindexed] in old and defines atom with the bitwise OR between the values of atom and value.

When stat [integer] is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call atomic_fetch_xor(atom, value, old[, stat])

Atomically stores the value of atom [integer(kind=atomic_int_kind), scalar coarray or coindexed] in old and defines atom with the bitwise XOR between the values of atom and value.

When stat [integer] is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call atomic_or(atom, value[, stat])

Atomically defines atom [integer(kind=atomic_int_kind), scalar coarray or coindexed] with the bitwise AND between the values of atom and value.

When stat [integer] is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call atomic_ref(value, atom[, stat])

Atomically assigns the value of the variable atom [integer(kind=atomic_int_kind) or logical(kind=atomic_logical_kind), scalar coarray or coindexed] to value.

When stat [integer (since Fortran 2018) is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2008, Fortran 2018
call atomic_xor(atom, value[, stat])

Atomically defines atom [integer(kind=atomic_int_kind), scalar coarray or coindexed] with the bitwise XOR between the values of atom and value.

When stat [integer] is present and the invocation was successful, it is assigned 0, else a positive value. In particular, for a coindexed atom, if the remote image has stopped, it is assigned the value of STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE, both from intrinsic Fortran module iso_fortran_env.

atomic subroutine Fortran 2018
call co_broadcast(a, source_image[, stat, errmsg])

Copies the value of argument a [integer, real, character; scalar or array] on the image with image index source_image [integer] to all images in the current team. a becomes defined as if by intrinsic assignment.

If the execution was successful and stat [integer] is present, it is assigned 0, else a positive value and, if present, errmsg [character] gets assigned a value describing the occurred error.

collective subroutine Fortran 2018
call co_max(a[, result_image, stat, errmsg])

Determines element-wise the maximal value of a [integer, real, character; scalar or array] on all images of the current team. If result_image [integer] is present, the maximum values are returned in a on the specified image only and the value of a on the other images become undefined. If result_image is not present, the value is returned on all images.

If the execution was successful and stat [integer] is present, it is assigned 0, else a positive value and, if present, errmsg [character] gets assigned a value describing the occurred error.

collective subroutine Fortran 2018
call co_min(a[, result_image, stat, errmsg])

Determines element-wise the minimum value of a [integer, real, character; scalar or array] on all images of the current team. If result_image [integer] is present, the minimum values are returned in a on the specified image only and the value of a on the other images become undefined. If result_image is not present, the value is returned on all images.

If the execution was successful and stat [integer] is present, it is assigned 0, else a positive value and, if present, errmsg [character] gets assigned a value describing the occurred error.

collective subroutine Fortran 2018
call co_reduce(a, operator[, result_image, stat, errmsg])

Determines element-wise the reduction of the value of a [scalar or array] on all images of the current team. The pure function passed as operator [two scalar nonallocatable arguments of the same type as a] is used to pairwise reduce the values of a by passing either the value of a of different images or the result values of such a reduction as argument.

If a is an array, the deduction is done element wise. If result_image [integer] is present, the result values are returned in a on the specified image only and the value of a on the other images become undefined. If result_image is not present, the value is returned on all images.

If the execution was successful and stat [integer] is present, it is assigned 0, else a positive value and, if present, errmsg [character] gets assigned a value describing the occurred error.

collective subroutine Fortran 2018
call co_sum(a[, result_image, stat, errmsg])

Sums up the values of each element of a [integer, real, or complex] on all images of the current team. If result_image [integer] is present, the summed-up values are returned in a on the specified image only and the value of a on the other images become undefined. If result_image is not present, the value is returned on all images.

If the execution was successful and stat [integer] is present, it is assigned 0, else a positive value and, if present, errmsg [character] gets assigned a value describing the occurred error.

collective subroutine Fortran 2018
result = coshape(coarray[, kind])

Returns a rank-one integer array whose size is the corank of corarray [coarray]. The value of element i is 1 + ucobound(coarray, i) - lcobound(coarry, i).

function Fortran 2018
call event_query(event, count[, stat])

Assigns the number of events to count [integer] which have been posted to event [type(event_type)] and not yet been removed by calling event wait.

When stat [integer] is present and the invocation was successful, it is assigned zero, otherwise a positive value and count [integer] is assigned −1.

subroutine Fortran 2018
result = image_index(coarray, sub)

Returns the image index belonging to a cosubscript. For invalid cosubscripts the result is zero.

inquiry function Fortran 2008
result = lcobound(coarray[, dim[, kind]])

Returns the lower bounds of coarray [coarray], or a single lower cobound along the dim [integer] codimension, with optional integer kind [integer] of the result.

inquiry function Fortran 2008
result = num_images(distance, failed)

Returns the number of images, with optional distance [integer, ≥ 0] and failed [logical] since Fortran 2018.

If distance is not present or has value 0, the number of images in the current team is returned. For values smaller or equal distance to the initial team, it returns the number of images index on the ancestor team which has a distance of distance from the invoking team. If distance is larger than the distance to the initial team, the number of images of the initial team is returned.

If failed is not present the total number of images is returned; if it has the value .true., the number of failed images is returned, otherwise, the number of images which do have not the failed status.

transformational function Fortran 2008, Fortran 2018
result = this_image()
result = this_image(distance)
result = this_image(coarray[, dim])

Returns the cosubscript for this image, with optional distance [integer, ≥ 0] since Fortran 2018.

If coarray [coarray] is not present, the result is scalar; if distance is not present or has value 0, its value is the image index on the invoking image for the current team, for values smaller or equal distance to the initial team, it returns the image index on the ancestor team which has a distance of distance from the invoking team.

If distance is larger than the distance to the initial team, the image index of the initial team is returned. Otherwise when the coarray is present, if dim [integer], between one and the corank of coarray is not present, a rank − 1 array with corank elements is returned, containing the cosubscripts for coarray specifying the invoking image.

If dim is present, a scalar is returned, with the value of the dim element of this_image(coarray).

transformational function Fortran 2008, Fortran 2018
result = ucobound(coarray[, dim[, kind]])

Returns the upper bounds of coarray [coarray], or a single lower cobound along the dim [integer] codimension, with optional integer kind [integer] of the result.

inquiry function Fortran 2008

References