Skip to content

Commit

Permalink
Fix indentation in introductory vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
BerriJ committed Sep 21, 2024
1 parent b9b171a commit 346f70a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions vignettes/rcpptimer.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,24 @@ print(times)
`rcpptimer` will group multiple timers with the same name and calculate summary statistics for them. Consider this more advanced example, which also uses OpenMP:

```c++
// fibonacci_omp.cpp
// fibonacci.cpp
std::vector<long int> fibonacci_omp(std::vector<long int> n)
{

Rcpp::Timer timer;

// This scoped timer measures the total execution time of 'fibonacci'
// This scoped timer measures the total execution time of 'fibonacci'
Rcpp::Timer::ScopedTimer scpdtmr(timer, "fib_body");

std::vector<long int> results = n;

#pragma omp parallel for
#pragma omp parallel for
for (unsigned int i = 0; i < n.size(); ++i)
{
timer.tic("fib_" + std::to_string(n[i]));
results[i] = fib(n[i]);
timer.toc("fib_" + std::to_string(n[i]));
}
{
timer.tic("fib_" + std::to_string(n[i]));
results[i] = fib(n[i]);
timer.toc("fib_" + std::to_string(n[i]));
}

return (results);
}
Expand Down

0 comments on commit 346f70a

Please sign in to comment.