public subroutine array_partition(n, k, p, start, count)
Compute start and count for the p'th partition of an array of size n
where p = 0, 1, ... , k - 1.
For k partitions, an array of n elements can be partitioned into r
partitions of length q + 1, and k - r partitions of length q where q
and r are the quotient and remainder of n divided by k (i.e. n = q *
k + r). Note, we assume that the r partitions of length q + 1 precede
the k - r partitions of length q in the array.
Arguments
Type
Intent
Optional
Attributes
Name
integer,
intent(in)
::
n
The total number of elements in the array to be partitioned.
integer,
intent(in)
::
k
The total number of partitions.
integer,
intent(in)
::
p
The index of the partition for which to compute the start and count (0-based).
integer,
intent(out)
::
start
The starting index (1-based) of the p'th partition in the array.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.