R Under development (unstable) (2024-05-20 r86569 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > if (!requireNamespace("statmod")) q("no") Loading required namespace: statmod > library("polyCub") > > ## statmod::gauss.quad() gives cached Gauss-Legendre nodes/weights > new.NWGL <- lapply( + X = seq_len(61L), + FUN = function (n) + unname(statmod::gauss.quad(n = n, kind = "legendre")) + ) > stopifnot(all.equal(new.NWGL, polyCub:::.NWGL, check.attributes = FALSE)) > > ## polyCub.SV() can fetch nodes and weights from 'statmod' > diamond <- list(list(x = c(1,2,1,0), y = c(1,2,3,2))) > nw <- polyCub.SV(diamond, f = NULL, nGQ = 83) # nGQ > 61 > stopifnot(is.list(nw)) > > ## polyCub.SV() can reduce nodes with zero weight > rectangle <- list(list(x = c(-1,1,1,-1), y = c(1,1,2,2))) > ##nw0 <- polyCub.SV(rectangle, f = NULL, nGQ = 3, engine = "C")[[1]] # 0s > nw <- polyCub.SV(rectangle, f = NULL, nGQ = 3, engine = "C+reduce")[[1]] > stopifnot(nw$weights != 0) > ##f <- function (s) 1 # => calculate area (= 2) > stopifnot(all.equal(sum(nw$weights), 2)) > > proc.time() user system elapsed 0.29 0.07 0.35