composition_from_idx Function

public pure function composition_from_idx(k, N, idx) result(composition)

Return the composition for a given composition index

The index is assigned by lexicographically decreasing order. This function is the inverse of composition_idx.


Type IntentOptional Attributes Name
integer, intent(in) :: k

k is the number of summands (k == size(composition)).

integer, intent(in) :: N

N is the sum over the composition (N == sum(composition)).

integer(kind=int64), intent(in) :: idx

The composition index.

Return Value integer, (k)