computeSplitters - SeqAn API Documentation

# fn() computeSplitters
Compute splitters for a sequence of objects.

Defined in | <seqan/parallel.h>
Signature | `void computeSplitters(splitters, size, count);`

## Parameters

`splitters` | Resulting splitters, will be resized to contain `count + 1` elements, e.g. an AllocString of integers.
`size` | The number of objects to split.
`count` | The number of chunks.

## Detailed Description

### Remarks

The first `count - 1` chunks will have the size `ceil(size / count)`, the last chunk will contain the rest.

### Examples

Most simple case for splitting.

    String<unsigned> splitters;
    computeSplitters(splitters, 10, 5);
    // splitters == {0, 5, 10}

In this case, the last chunks will stay empty.

    computeSplitters(splitters, 3, 5);
    // splitters == {0, 1, 2, 3, 3, 3}

## Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

#### Dox Sources

    /*!
     * @fn computeSplitters
     *
     * @headerfile <seqan/parallel.h>
     *
     * @brief Compute splitters for a sequence of objects.
     *
     * @signature void computeSplitters(splitters, size, count);
     *
     * @param[out] splitters Resulting splitters, will be resized to contain
     *                       <tt>count + 1</tt> elements, e.g. an @link AllocString
     *                       @endlink of integers.
     * @param[in] size The number of objects to split.
     * @param[in] count The number of chunks.
     *
     * @section Remarks
     *
     * The first <tt>count - 1</tt> chunks will have the size <tt>ceil(size /
     * count)</tt>, the last chunk will contain the rest.
     *
     * @section Examples
     *
     * Most simple case for splitting.
     *
     * @code{.cpp}
     * String<unsigned> splitters;
     * computeSplitters(splitters, 10, 5);
     * // splitters == {0, 5, 10}
     * @endcode
     *
     *
     * In this case, the last chunks will stay empty.
     *
     * @code{.cpp}
     * computeSplitters(splitters, 3, 5);
     * // splitters == {0, 1, 2, 3, 3, 3}
     * @endcode
     */