R/RcppExports.R

Defines functions test_stats test_misc test_reset test_update test_default fibonacci_omp fibonacci

Documented in fibonacci fibonacci_omp

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Simple rcpptimer example
#'
#' Time the computation of Fibonacci numbers
#'
#' @details
#' The function being timed is the following:
#'
#' \code{int fib(int n) { return ((n <= 1) ? n : fib(n - 1) + fib(n - 2)); }}
#'
#' Runtime for computations less than \code{n = 15} is nearly unmeasurable.
#'
#' @param n vector giving integers for which to compute the Fibonacci sum
#' @return vector of integers giving the Fibonacci sum for each element in
#' \code{n}
#' @export
#' @examples
#' \donttest{
#' fibonacci(n = rep(20:25, 10))
#' # this function creates a global environment variable "times"
#' times
#' }
fibonacci <- function(n) {
    .Call(`_rcpptimer_fibonacci`, n)
}

#' Simple rcpptimer example using OpenMP
#'
#' Time the multithreaded computation of Fibonacci numbers
#'
#' @details
#' The function being timed is the following:
#'
#' \code{int fib(int n) { return ((n <= 1) ? n : fib(n - 1) + fib(n - 2)); }}
#'
#' Runtime for computations less than \code{n = 15} is nearly unmeasurable.
#'
#' @param n vector giving integers for which to compute the Fibonacci sum
#' @return vector of integers giving the Fibonacci sum for each element in
#' \code{n}
#' @export
#' @examples
#' \donttest{
#' fibonacci_omp(n = rep(20:25, 10))
#' # this function creates a global environment variable "times"
#' times
#' }
fibonacci_omp <- function(n) {
    .Call(`_rcpptimer_fibonacci_omp`, n)
}

test_default <- function() {
    invisible(.Call(`_rcpptimer_test_default`))
}

test_update <- function() {
    .Call(`_rcpptimer_test_update`)
}

test_reset <- function() {
    .Call(`_rcpptimer_test_reset`)
}

test_misc <- function(tic = TRUE, toc = TRUE, extra_toc = FALSE, verbose = TRUE, autoreturn = TRUE, scoped_timer = TRUE) {
    .Call(`_rcpptimer_test_misc`, tic, toc, extra_toc, verbose, autoreturn, scoped_timer)
}

test_stats <- function(N, K, missing_tic = FALSE, missing_toc = FALSE, extra_toc = FALSE) {
    .Call(`_rcpptimer_test_stats`, N, K, missing_tic, missing_toc, extra_toc)
}

Try the rcpptimer package in your browser

Any scripts or data that you put into this service are public.

rcpptimer documentation built on Sept. 30, 2024, 9:30 a.m.