Skip to contents

Calculate the sum of a vector of numbers using multiple threads.

Usage

sum_with_threads(x, n)

Arguments

x

A vector of numbers to sum over.

n

The number of threads used to compute this calculation (int).

Value

The sum of all elements of the input vector.

Examples

sum_with_threads(c(1,2), 2)
#> [1] 3