def _flatten_action_profile(action_profile, indptr):
    """
    Flatten the given action profile.

    Parameters
    ----------
    action_profile : array_like(int or array_like(float, ndim=1))
        Profile of actions of the N players, where each player i' action
        is a pure action (int) or a mixed action (array_like of floats
        of length n_i).

    indptr : array_like(int, ndim=1)
        Array of index pointers of length N+1, where `indptr[0] = 0` and
        `indptr[i+1] = indptr[i] + n_i`.

    Returns
    -------
    out : ndarray(float, ndim=1)
        Array of flattened mixed action profile of length equal to n_0 +
        ... + n_N-1, where `out[indptr[i]:indptr[i+1]]` contains player
        i's mixed action.

    """
    N = len(indptr) - 1
    out = np.empty(indptr[-1])

    for i in range(N):
        if isinstance(action_profile[i], numbers.Integral):  # pure action
            num_actions = indptr[i+1] - indptr[i]
            mixed_action = pure2mixed(num_actions, action_profile[i])
        else:  # mixed action
            mixed_action = action_profile[i]
        out[indptr[i]:indptr[i+1]] = mixed_action

    return out
Flatten the given action profile.

    Parameters
    ----------
    action_profile : array_like(int or array_like(float, ndim=1))
        Profile of actions of the N players, where each player i' action
        is a pure action (int) or a mixed action (array_like of floats
        of length n_i).

    indptr : array_like(int, ndim=1)
        Array of index pointers of length N+1, where `indptr[0] = 0` and
        `indptr[i+1] = indptr[i] + n_i`.

    Returns
    -------
    out : ndarray(float, ndim=1)
        Array of flattened mixed action profile of length equal to n_0 +
        ... + n_N-1, where `out[indptr[i]:indptr[i+1]]` contains player
        i's mixed action.