partialSum - SeqAn API Documentation

# fn() partialSum
Computes the partial sum of a sequence.

Defined in | <seqan/parallel.h>
Signature | `TValue partialSum(target, source[, parallelTag]);`

## Parameters

`source` | A sequence of elements that should be partially summed. The sequence alphabet must support the `operator+` and conversion from zero, the type is `TSource`.
`parallelTag` | Tag to enable/disable parallelism, one of `Serial`, `Parallel`, default is `Serial`.
`target` | The resulting partial sum. This sequence will have the same length as `source` and contains at position `i` the sum of elements `source[0]`, `source[1]`, ..., `source[i]`.

## Return Values

`TValue` | The sum of all elements in `source`. The returned value equals the last value in target. `TValue` is `Value<TSource>::Type`.

## Data Races

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

## See Also

- sum

#### Dox Sources

    /*!
     * @fn partialSum
     *
     * @headerfile <seqan/parallel.h>
     *
     * @brief Computes the partial sum of a sequence.
     *
     * @signature TValue partialSum(target, source[, parallelTag]);
     *
     * @param[in] source A sequence of elements that should be partially summed. The
     *                   sequence alphabet must support the <tt>operator+</tt> and
     *                   conversion from zero, the type is <tt>TSource</tt>.
     * @param[in] parallelTag Tag to enable/disable parallelism, one of
     *                        <tt>Serial</tt>, <tt>Parallel</tt>, default is
     *                        <tt>Serial</tt>.
     * @param[out] target The resulting partial sum. This sequence will have the
     *                    same length as <tt>source</tt> and contains at position
     *                    <tt>i</tt> the sum of elements <tt>source[0]</tt>,
     *                    <tt>source[1]</tt>, ..., <tt>source[i]</tt>.
     *
     * @return TValue The sum of all elements in <tt>source</tt>. The returned value
     *                equals the last value in target. <tt>TValue</tt> is
     *                <tt>Value&lt;TSource&gt;::Type</tt>.
     *
     * @see sum
     */