fibonacci_omp | R Documentation |
Time the multithreaded computation of Fibonacci numbers
fibonacci_omp(n)
n |
vector giving integers for which to compute the Fibonacci sum |
The function being timed is the following:
int fib(int n) { return ((n <= 1) ? n : fib(n - 1) + fib(n - 2)); }
Runtime for computations less than n = 15
is nearly unmeasurable.
vector of integers giving the Fibonacci sum for each element in
n
fibonacci_omp(n = rep(20:25, 10))
# this function creates a global environment variable "times"
times
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.