array_partition Subroutine

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 IntentOptional 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.

integer, intent(out) :: count

The number of elements in the p'th partition.


Called by

proc~~array_partition~~CalledByGraph proc~array_partition array_partition proc~init_local_structure_variables init_local_structure_variables proc~init_local_structure_variables->proc~array_partition proc~load_parameters load_parameters proc~load_parameters->proc~init_local_structure_variables proc~mpidrv_master~2 mpidrv_master proc~mpidrv_master~2->proc~load_parameters proc~serialdrv serialdrv proc~serialdrv->proc~load_parameters program~cable_offline_driver cable_offline_driver program~cable_offline_driver->proc~serialdrv