R Under development (unstable) (2018-07-12 r74953) -- "Unsuffered Consequences" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > #dyn.load("../src/R2Cuba.so");source("../R/divonne.R");source("../R/commoncuba.R") > library("R2Cuba") > # DEMO EXAMPLES > # +++++++++++++++++++++++++++++++ > integrand <- function(arg, phase) { + x <- arg[1] + y <- arg[2] + z <- arg[3] + # cat("PHASE", phase) + ff <- sin(x)*cos(y)*exp(z); + return(ff) + } # fin integrand > > NDIM <- 3 > NCOMP <- 1 > NMAX <- 4 > divonne(NDIM, NCOMP, integrand, flags=list(verbose=3)) Divonne input parameters: ndim 3 ncomp 1 rel.tol 0.001 abs.tol 4.93038e-32 pseudo.random 0 final 0 verbose 3 min.eval 0 max.eval 50000 key1 47 key2 1 key3 1 max.pass 5 border 0 max.chisq 10 min.deviation 0.25 ngiven 0 nextra 0 Partitioning phase: Iteration 1 (pass 0): 8 regions 836 integrand evaluations so far, 406 in optimizing regions, 70 in finding cuts [1] 0.665011 +- 0.00470198 Iteration 2 (pass 0): 9 regions 966 integrand evaluations so far, 478 in optimizing regions, 80 in finding cuts [1] 0.664964 +- 0.00429467 Iteration 3 (pass 1): 10 regions 1096 integrand evaluations so far, 550 in optimizing regions, 90 in finding cuts [1] 0.664949 +- 0.00388393 Iteration 4 (pass 2): 11 regions 1194 integrand evaluations so far, 590 in optimizing regions, 100 in finding cuts [1] 0.664887 +- 0.0035842 Iteration 5 (pass 3): 12 regions 1308 integrand evaluations so far, 646 in optimizing regions, 110 in finding cuts [1] 0.664853 +- 0.0033385 Iteration 6 (pass 4): 13 regions 1438 integrand evaluations so far, 718 in optimizing regions, 120 in finding cuts [1] 0.664825 +- 0.0031276 Iteration 7 (pass 5): 14 regions 1568 integrand evaluations so far, 790 in optimizing regions, 130 in finding cuts [1] 0.664816 +- 0.00292074 Main integration on 14 regions with 211 samples per region. Region (0.500000) - (1.000000) (0.500000) - (1.000000) (0.750000) - (1.000000) [1] 0.0734093 +- 0.000973987(0) 0.0734148 +- 0.000216954(0) chisq 3.01079e-05 Region (0.500000) - (1.000000) (0.500000) - (1.000000) (0.250000) - (0.500000) [1] 0.044525 +- 0.000590753(0) 0.0445283 +- 0.000131589(0) chisq 3.01079e-05 Region (0.500000) - (1.000000) (0.000000) - (0.500000) (0.250000) - (0.500000) [1] 0.0589836 +- 0.000570564(0) 0.0589702 +- 0.000127093(0) chisq 0.000521926 Region (0.000000) - (0.500000) (0.000000) - (0.500000) (0.000000) - (0.500000) [1] 0.0381429 +- 0.00113948(0) 0.0380717 +- 0.000253818(0) chisq 0.00371754 Region (0.000000) - (0.500000) (0.500000) - (1.000000) (0.000000) - (0.500000) [1] 0.0287671 +- 0.000993733(0) 0.028742 +- 0.000221353(0) chisq 0.00060887 Region (0.500000) - (1.000000) (0.000000) - (0.500000) (0.750000) - (1.000000) [1] 0.0972475 +- 0.000940702(0) 0.0972254 +- 0.00020954(0) chisq 0.000521926 Region (0.000000) - (0.500000) (0.000000) - (0.500000) (0.750000) - (1.000000) [1] 0.0353188 +- 0.000882485(0) 0.0352871 +- 0.000196572(0) chisq 0.00122497 Region (0.000000) - (0.500000) (0.500000) - (1.000000) (0.750000) - (1.000000) [1] 0.0266444 +- 0.000769162(0) 0.026641 +- 0.00017133(0) chisq 1.87223e-05 Region (0.500000) - (1.000000) (0.000000) - (0.500000) (0.500000) - (0.750000) [1] 0.0757364 +- 0.000735203(0) 0.0757192 +- 0.000163766(0) chisq 0.000518264 Region (0.500000) - (1.000000) (0.500000) - (1.000000) (0.500000) - (0.750000) [1] 0.0571712 +- 0.000759382(0) 0.0571755 +- 0.000169152(0) chisq 3.00413e-05 Region (0.000000) - (0.500000) (0.000000) - (0.500000) (0.500000) - (0.750000) [1] 0.0275063 +- 0.000690701(0) 0.0274817 +- 0.000153853(0) chisq 0.00121287 Region (0.000000) - (0.500000) (0.500000) - (1.000000) (0.500000) - (0.750000) [1] 0.0207507 +- 0.000600894(0) 0.0207481 +- 0.000133848(0) chisq 1.86059e-05 Region (0.500000) - (1.000000) (0.000000) - (0.500000) (0.000000) - (0.250000) [1] 0.0459364 +- 0.000445923(0) 0.045926 +- 9.93288e-05(0) chisq 0.000518264 Region (0.500000) - (1.000000) (0.500000) - (1.000000) (0.000000) - (0.250000) [1] 0.0346761 +- 0.000460589(0) 0.0346787 +- 0.000102596(0) chisq 3.00413e-05 Totals: [1] 0.66462 +- 0.000635028 chisq 0.00900226 (14 df) integral: 0.6646195 (+-0.00064) nregions: 14; number of evaluations: 3052; probability: 1.110223e-16 > # ------------------------------------------------------------ > # Essai avec des arguments ... > integrandp <- function(arg, phase, ...) { + x <- arg[1] + y <- arg[2] + z <- arg[3] + #print("i", ...) + ff <- sin(x)*cos(y)*exp(z); + return(ff) + } # fin integrandp > divonne(NDIM, NCOMP, integrandp, quote=FALSE, flags=list(verbose=0)) integral: 0.6646195 (+-0.00064) nregions: 14; number of evaluations: 3052; probability: 1.110223e-16 > > > # ------------------------------------------------------------ > # Essai en déplacant les bornes > integrand2 <- function(arg,phase, a) { + x <- arg[1] + y <- arg[2] + z <- arg[3] + ff <- sin(x-3)*cos(y-2)*exp(z-1); + return(ff) + } # End integrand2 > divonne(NDIM, NCOMP, integrand2, lower=c(3,2,1), upper=c(4,3,2), flags=list(verbose=3)) Divonne input parameters: ndim 3 ncomp 1 rel.tol 0.001 abs.tol 4.93038e-32 pseudo.random 0 final 0 verbose 3 min.eval 0 max.eval 50000 key1 47 key2 1 key3 1 max.pass 5 border 0 max.chisq 10 min.deviation 0.25 ngiven 0 nextra 0 Partitioning phase: Iteration 1 (pass 0): 8 regions 836 integrand evaluations so far, 406 in optimizing regions, 70 in finding cuts [1] 0.665011 +- 0.00470198 Iteration 2 (pass 0): 9 regions 966 integrand evaluations so far, 478 in optimizing regions, 80 in finding cuts [1] 0.664964 +- 0.00429467 Iteration 3 (pass 1): 10 regions 1096 integrand evaluations so far, 550 in optimizing regions, 90 in finding cuts [1] 0.664949 +- 0.00388393 Iteration 4 (pass 2): 11 regions 1194 integrand evaluations so far, 590 in optimizing regions, 100 in finding cuts [1] 0.664887 +- 0.0035842 Iteration 5 (pass 3): 12 regions 1308 integrand evaluations so far, 646 in optimizing regions, 110 in finding cuts [1] 0.664853 +- 0.0033385 Iteration 6 (pass 4): 13 regions 1438 integrand evaluations so far, 718 in optimizing regions, 120 in finding cuts [1] 0.664825 +- 0.0031276 Iteration 7 (pass 5): 14 regions 1568 integrand evaluations so far, 790 in optimizing regions, 130 in finding cuts [1] 0.664816 +- 0.00292074 Main integration on 14 regions with 211 samples per region. Region (3.500000) - (4.000000) (2.500000) - (3.000000) (1.750000) - (2.000000) [1] 0.0734093 +- 0.000973987(0) 0.0734148 +- 0.000216954(0) chisq 3.01079e-05 Region (3.500000) - (4.000000) (2.500000) - (3.000000) (1.250000) - (1.500000) [1] 0.044525 +- 0.000590753(0) 0.0445283 +- 0.000131589(0) chisq 3.01079e-05 Region (3.500000) - (4.000000) (2.000000) - (2.500000) (1.250000) - (1.500000) [1] 0.0589836 +- 0.000570564(0) 0.0589702 +- 0.000127093(0) chisq 0.000521926 Region (3.000000) - (3.500000) (2.000000) - (2.500000) (1.000000) - (1.500000) [1] 0.0381429 +- 0.00113948(0) 0.0380717 +- 0.000253818(0) chisq 0.00371754 Region (3.000000) - (3.500000) (2.500000) - (3.000000) (1.000000) - (1.500000) [1] 0.0287671 +- 0.000993733(0) 0.028742 +- 0.000221353(0) chisq 0.00060887 Region (3.500000) - (4.000000) (2.000000) - (2.500000) (1.750000) - (2.000000) [1] 0.0972475 +- 0.000940702(0) 0.0972254 +- 0.00020954(0) chisq 0.000521926 Region (3.000000) - (3.500000) (2.000000) - (2.500000) (1.750000) - (2.000000) [1] 0.0353188 +- 0.000882485(0) 0.0352871 +- 0.000196572(0) chisq 0.00122497 Region (3.000000) - (3.500000) (2.500000) - (3.000000) (1.750000) - (2.000000) [1] 0.0266444 +- 0.000769162(0) 0.026641 +- 0.00017133(0) chisq 1.87223e-05 Region (3.500000) - (4.000000) (2.000000) - (2.500000) (1.500000) - (1.750000) [1] 0.0757364 +- 0.000735203(0) 0.0757192 +- 0.000163766(0) chisq 0.000518264 Region (3.500000) - (4.000000) (2.500000) - (3.000000) (1.500000) - (1.750000) [1] 0.0571712 +- 0.000759382(0) 0.0571755 +- 0.000169152(0) chisq 3.00413e-05 Region (3.000000) - (3.500000) (2.000000) - (2.500000) (1.500000) - (1.750000) [1] 0.0275063 +- 0.000690701(0) 0.0274817 +- 0.000153853(0) chisq 0.00121287 Region (3.000000) - (3.500000) (2.500000) - (3.000000) (1.500000) - (1.750000) [1] 0.0207507 +- 0.000600894(0) 0.0207481 +- 0.000133848(0) chisq 1.86059e-05 Region (3.500000) - (4.000000) (2.000000) - (2.500000) (1.000000) - (1.250000) [1] 0.0459364 +- 0.000445923(0) 0.045926 +- 9.93288e-05(0) chisq 0.000518264 Region (3.500000) - (4.000000) (2.500000) - (3.000000) (1.000000) - (1.250000) [1] 0.0346761 +- 0.000460589(0) 0.0346787 +- 0.000102596(0) chisq 3.00413e-05 Totals: [1] 0.66462 +- 0.000635028 chisq 0.00900226 (14 df) integral: 0.6646195 (+-0.00064) nregions: 14; number of evaluations: 3052; probability: 1.110223e-16 > # ------------------------------------------------------------ > # Essai avec mersenne.seed > EPSREL <- 1e-3 > EPSABS <- 1e-12 > divonne(NDIM, NCOMP, integrand, + rel.tol=EPSREL, abs.tol=EPSABS, + flags=list(verbose=0, pseudo.random=1, mersenne.seed=10)) integral: 0.6646195 (+-0.00064) nregions: 14; number of evaluations: 3052; probability: 1.110223e-16 > # --------------------------------------------------------------- > # Essai d'intégrande a pls composantes > integrand3 <- function(arg, phase,a) { + x <- arg[1] + y <- arg[2] + z <- arg[3] + ff <- sin(x)*cos(y)*exp(z); + gg <- 1/(3.75 - cos(pi*x) - cos(pi*y) - cos(pi*z)); + return(c(ff,gg)) + } # End integrand3 > divonne(NDIM,2, integrand3, flags=list(verbose=3)) Divonne input parameters: ndim 3 ncomp 2 rel.tol 0.001 abs.tol 4.93038e-32 pseudo.random 0 final 0 verbose 3 min.eval 0 max.eval 50000 key1 47 key2 1 key3 1 max.pass 5 border 0 max.chisq 10 min.deviation 0.25 ngiven 0 nextra 0 Partitioning phase: ================================================================= ==38631==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7fff44f39e68 at pc 0x7f49ccdac50c bp 0x7fff44f39b20 sp 0x7fff44f39b18 READ of size 8 at 0x7fff44f39e68 thread T0 #0 0x7f49ccdac50b in SolveEqs /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Split.c:131:35 #1 0x7f49ccdae931 in FindCuts /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Split.c:228:3 #2 0x7f49ccdb114b in Split /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Split.c:296:10 #3 0x7f49ccd70f42 in Explore /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Explore.c:186:23 #4 0x7f49ccd8333e in divonneIntegrate /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Integrate.c:121:3 #5 0x7f49ccd692ef in Divonne /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Divonne.c:232:14 #6 0x7f49ccd69d2d in divonne /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Divonne.c:257:3 #7 0x7f49ccd6a665 in Rdivonne /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Divonne.c:305:3 #8 0x872893 in do_dotCode /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c #9 0x9c488a in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6787:14 #10 0x9af12d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8 #11 0xa22bc6 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #12 0x9b0304 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12 #13 0xb1bae0 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:258:2 #14 0xb207e0 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:308:11 #15 0xb205c5 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1082:5 #16 0x52a2ea in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29:5 #17 0x7f49da31118a in __libc_start_main (/lib64/libc.so.6+0x2318a) #18 0x42da79 in _start (/data/gannet/ripley/R/R-clang-SAN/bin/exec/R+0x42da79) Address 0x7fff44f39e68 is located in stack of thread T0 SUMMARY: AddressSanitizer: dynamic-stack-buffer-overflow /data/gannet/ripley/R/packages/tests-clang-SAN/R2Cuba/src/divonne_Split.c:131:35 in SolveEqs Shadow bytes around the buggy address: 0x1000689df370: 00 00 00 00 00 00 00 00 00 00 00 00 ca ca ca ca 0x1000689df380: 00 00 00 00 00 00 cb cb cb cb cb cb 00 00 00 00 0x1000689df390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000689df3a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000689df3b0: 00 00 00 00 00 00 00 00 00 00 00 00 ca ca ca ca =>0x1000689df3c0: 00 00 00 00 00 00 cb cb cb cb cb cb ca[ca]ca ca 0x1000689df3d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000689df3e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000689df3f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000689df400: 00 00 00 00 00 00 cb cb cb cb cb cb 00 00 00 00 0x1000689df410: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==38631==ABORTING