MAJOR=13
MINOR=68
DEVNAME=input/event4
     OˆÜÛâ593Ú¿à Q    O‹      Õ–QoÚ0Çßû)<?ì�¤tšhÈÔ¤¡µ€(Ó4M2±!‰ÙûôsÚ�¶=´Ržr¾ücÿgË¹àM4êM¿�ûäÓôážŒ¿|¼ôm |½îDÓ¨zÑöš-€þ�š æ€Ífãm®=m–0�@‚YÚ‹FÆèqä4¼
Ê\xE‚D0îž$@‰©Š‹ŸD/è­äÂ?ÀufÁ
Å2™öëÅZçn®cÛ°6=¨Ýr[\¬!N˜�vçl1w9 n[�ë�0TË:#°wÌ5ß–[¯oÆ­¹+›ï<•¡	LÈš¥r©ºuNÃ@fKbMÜ¥ c­,ÌS¦VÞR.(a)vé÷AoôÃé “òë0`$1bÑ¥zÝáí¨ÑpÈ2 ;¯ypš;Þ3‹$Ó\.¤àÅ�•øQþº<aTi"ac#s”Z¥àOQc�Úœ9ÖG�˜SU%á«‹Ÿc|7é§Ñ`R•„—SÝ½øÖÒpÌŒPH"iDŒÚl÷ì•‘·jnóÛÃ�ìÉŒ\&HCBä¬ò?ÊQ¨•ÒuZWí³µ`v«bî§&Ÿ¹ò›þ»FËo4}Òô;þ{B.Ý½ðù5í¨mas·u3.R¶�eÖÑœÉÖÎéÑè”†û †¦P(31c1Êµ˜­$wÛs&Y´2þ­ŒkŒ&TùWâG¬}¢ÆH'g°×¨ºçvŸækXX¶<áÚ_ç»Ø÷mìZÈ ª÷73Ïq˜F    6   Qˆl—Ðz¾”d
i?u8 \¸Ó·uLZ7ÿ�þB gÁ 7à?Ÿäƒh¹ãÀá      QMAJOR=4
MINOR=26
DEVNAME=tty26
  6   Sˆl–äY>”jeJeAà¸ÈTÅ£�þDøžY¹Y€x’Êùå„eÏäÁâ )(    S## ----echo=FALSE---------------------------------------------------------------
knitr::opts_chunk$set(
    message = FALSE,
    warning = FALSE,
    error = FALSE,
    tidy = FALSE,
    cache = FALSE
)

## -----------------------------------------------------------------------------
library(benchr)
library(cubature)

harness <- function(which = NULL,
                    f, fv, lowerLimit, upperLimit, tol = 1e-3, times = 20, ...) {

    fns <- c(hc = "Non-vectorized Hcubature",
             hc.v = "Vectorized Hcubature",
             pc = "Non-vectorized Pcubature",
             pc.v = "Vectorized Pcubature",
             cc = "Non-vectorized cubature::cuhre",
             cc_v = "Vectorized cubature::cuhre")
    cc <- function() cubature::cuhre(f = f,
                                     lowerLimit = lowerLimit, upperLimit = upperLimit,
                                     relTol = tol,
                                     ...)
    cc_v <- function() cubature::cuhre(f = fv,
                                       lowerLimit = lowerLimit, upperLimit = upperLimit,
                                       relTol = tol,
                                       nVec = 1024L,
                                       ...)

    hc <- function() cubature::hcubature(f = f,
                                         lowerLimit = lowerLimit,
                                         upperLimit = upperLimit,
                                         tol = tol,
                                         ...)

    hc.v <- function() cubature::hcubature(f = fv,
                                           lowerLimit = lowerLimit,
                                           upperLimit = upperLimit,
                                           tol = tol,
                                           vectorInterface = TRUE,
                                           ...)

    pc <- function() cubature::pcubature(f = f,
                                     lowerLimit = lowerLimit,
                                     upperLimit = upperLimit,
                                     tol = tol,
                                     ...)

    pc.v <- function() cubature::pcubature(f = fv,
                                           lowerLimit = lowerLimit,
                                           upperLimit = upperLimit,
                                           tol = tol,
                                           vectorInterface = TRUE,
                                           ...)
    
    ndim = length(lowerLimit)

    if (is.null(which)) {
        fnIndices <- seq_along(fns)
    } else {
        fnIndices <- na.omit(match(which, names(fns)))
    }
    fnList <- lapply(names(fns)[fnIndices], function(x) call(x))

    argList <- c(fnList, times = times, progress = FALSE)
    result <- do.call(benchr::benchmark, args = argList)
    d <- summary(result)[seq_along(fnIndices), ]
    d$expr <- fns[fnIndices]
    d
}

## -----------------------------------------------------------------------------
func <- function(x) sin(x[1]) * cos(x[2]) * exp(x[3])
func.v <- function(x) {
    matrix(apply(x, 2, function(z) sin(z[1]) * cos(z[2]) * exp(z[3])), ncol = ncol(x))
}

d <- harness(f = func, fv = func.v,
             lowerLimit = rep(0, 3),
           