├── .github ├── FUNDING.yml ├── PULL_REQUEST_TEMPLATE.md ├── CONTRIBUTING.md ├── workflows │ ├── linuxarm.yaml │ ├── macos.yaml │ └── stale.yaml └── ISSUE_TEMPLATE.md ├── inst ├── tinytest │ ├── testRcppInterfaceUser │ │ ├── src │ │ │ ├── config.h │ │ │ ├── user.cpp │ │ │ └── unwound.h │ │ ├── NAMESPACE │ │ ├── DESCRIPTION │ │ └── R │ │ │ └── user.R │ ├── testRcppPackage │ │ ├── debian │ │ │ ├── compat │ │ │ ├── source │ │ │ │ └── format │ │ │ ├── rules │ │ │ ├── changelog │ │ │ └── control │ │ ├── NAMESPACE │ │ ├── R │ │ │ └── rcpp_hello_world.R │ │ ├── src │ │ │ ├── rcpp_hello_world.h │ │ │ └── rcpp_hello_world.cpp │ │ ├── DESCRIPTION │ │ └── man │ │ │ └── testRcppPackage-package.Rd │ ├── testRcppModule │ │ ├── NAMESPACE │ │ ├── R │ │ │ ├── rcpp_hello_world.R │ │ │ └── zzz.R │ │ ├── src │ │ │ ├── rcpp_hello_world.h │ │ │ ├── rcpp_hello_world.cpp │ │ │ └── init.c │ │ ├── man │ │ │ ├── rcpp_hello_world.Rd │ │ │ ├── testRcppModule-package.Rd │ │ │ └── Rcpp_modules_examples.Rd │ │ ├── tests │ │ │ └── modules.R │ │ └── DESCRIPTION │ ├── src │ │ ├── r-cran-testrcpppackage_0.1.0-1.diff.gz │ │ ├── r-cran-testrcpppackage_0.1.0-1_i386.deb │ │ ├── r-cran-testrcpppackage_0.1.0-1_amd64.deb │ │ └── r-cran-testrcpppackage_0.1.0-1.dsc │ ├── testRcppClass │ │ ├── R │ │ │ └── rcpp_hello_world.R │ │ ├── src │ │ │ ├── rcpp_hello_world.h │ │ │ ├── rcpp_hello_world.cpp │ │ │ ├── Num.cpp │ │ │ ├── init.c │ │ │ └── rcpp_module.cpp │ │ ├── NAMESPACE │ │ ├── man │ │ │ ├── rcpp_hello_world.Rd │ │ │ ├── testRcppClass-package.Rd │ │ │ └── Rcpp_class_examples.Rd │ │ ├── tests │ │ │ └── classes.R │ │ └── DESCRIPTION │ ├── bin │ │ ├── i386 │ │ │ └── r-cran-testrcpppackage_0.1.0-1_i386.deb │ │ └── amd64 │ │ │ └── r-cran-testrcpppackage_0.1.0-1_amd64.deb │ ├── testRcppAttributePackage │ │ ├── NAMESPACE │ │ └── DESCRIPTION │ ├── testRcppInterfaceExporter │ │ ├── NAMESPACE │ │ ├── DESCRIPTION │ │ ├── inst │ │ │ └── include │ │ │ │ └── testRcppInterfaceExporter.h │ │ ├── R │ │ │ ├── exporter.R │ │ │ └── RcppExports.R │ │ └── src │ │ │ ├── exporter.cpp │ │ │ └── unwound.h │ ├── cpp │ │ ├── attributes.hpp │ │ ├── Exceptions_nocall.cpp │ │ ├── wstring.cpp │ │ ├── rcppversion.cpp │ │ ├── coerce.cpp │ │ ├── embeddedR.cpp │ │ ├── embeddedR2.cpp │ │ ├── Reference.cpp │ │ ├── VectorOld.cpp │ │ └── na.cpp │ ├── test_coerce.R │ ├── test_internal_function.R │ ├── test_vector_old.R │ ├── test_reference.R │ ├── test_internal_function_cpp11.R │ ├── test_exceptions_nocall.R │ ├── test_na.R │ └── test_modref.R ├── skeleton │ ├── rcpp_hello_world.R │ ├── rcpp_hello_world.Rd │ ├── rcpp_hello_world.cpp │ ├── zzz.R │ ├── rcpp_hello_world_attributes.cpp │ ├── Rcpp_modules_examples.Rd │ ├── rcpp_hello_world.h │ └── manual-page-stub.Rd ├── examples │ ├── Attributes │ │ ├── sourceCpp.R │ │ ├── Export.cpp │ │ └── Depends.cpp │ ├── OpenMP │ │ ├── check.R │ │ └── GNUmakefile │ ├── Misc │ │ ├── piSugar.cpp │ │ ├── piBySimulation.r │ │ └── newFib.r │ ├── ConvolveBenchmarks │ │ ├── overhead.sh │ │ ├── loopmacro.h │ │ ├── overhead_1.cpp │ │ ├── overhead_2.c │ │ ├── convolve10_cpp.h │ │ ├── convolve5_cpp.cpp │ │ ├── convolve3_cpp.cpp │ │ ├── convolve11_cpp.cpp │ │ ├── convolve14_cpp.cpp │ │ ├── convolve7_c.c │ │ ├── convolve2_c.c │ │ ├── convolve12_cpp.cpp │ │ ├── buildAndRun.sh │ │ ├── convolve4_cpp.cpp │ │ ├── overhead.r │ │ ├── convolve13_cpp.cpp │ │ ├── GNUmakefile │ │ ├── convolve10_cpp.cpp │ │ └── convolve8_cpp.cpp │ ├── RcppInline │ │ └── RcppSimpleExample.r │ ├── performance │ │ └── performance.R │ ├── functionCallback │ │ └── README │ └── SugarPerformance │ │ └── Timertest.cpp ├── include │ └── Rcpp │ │ ├── storage │ │ ├── storage.h │ │ └── NoProtectStorage.h │ │ ├── traits │ │ ├── enable_if.h │ │ ├── is_bool.h │ │ ├── index_sequence.h │ │ ├── num2type.h │ │ ├── if_.h │ │ ├── is_trivial.h │ │ ├── is_pointer.h │ │ ├── is_primitive.h │ │ ├── same_type.h │ │ ├── init_type.h │ │ └── is_reference.h │ │ ├── Rcpp │ │ ├── protection │ │ └── protection.h │ │ ├── Light │ │ ├── macros │ │ └── cat.hpp │ │ ├── proxy │ │ ├── GenericProxy.h │ │ └── proxy.h │ │ ├── stats │ │ ├── f.h │ │ ├── t.h │ │ ├── pois.h │ │ ├── nf.h │ │ ├── nt.h │ │ ├── binom.h │ │ ├── beta.h │ │ ├── geom.h │ │ ├── chisq.h │ │ ├── hyper.h │ │ ├── nbeta.h │ │ ├── nbinom.h │ │ ├── nchisq.h │ │ ├── nbinom_mu.h │ │ └── random │ │ │ ├── rpois.h │ │ │ ├── rsignrank.h │ │ │ ├── rwilcox.h │ │ │ └── rbeta.h │ │ ├── Lighter │ │ ├── api │ │ ├── meat │ │ │ ├── as.h │ │ │ ├── Dimension.h │ │ │ ├── DataFrame.h │ │ │ ├── message.h │ │ │ └── protection.h │ │ └── bones │ │ │ ├── bones.h │ │ │ └── wrap_extra_steps.h │ │ ├── Lightest │ │ ├── sugar │ │ ├── functions │ │ │ ├── mapply.h │ │ │ ├── strings │ │ │ │ └── strings.h │ │ │ ├── Lazy.h │ │ │ ├── duplicated.h │ │ │ └── match.h │ │ ├── logical │ │ │ ├── can_have_na.h │ │ │ └── logical.h │ │ ├── sets.h │ │ ├── sugar_forward.h │ │ ├── block │ │ │ └── block.h │ │ ├── sugar.h │ │ └── matrix │ │ │ └── matrix_functions.h │ │ ├── hash │ │ └── hash.h │ │ ├── vector │ │ └── 00_forward_Vector.h │ │ ├── print.h │ │ ├── internal │ │ └── na.h │ │ ├── longlong.h │ │ ├── Extractor.h │ │ ├── r │ │ └── compat.h │ │ ├── sprintf.h │ │ └── clone.h └── prompt │ └── module.Rd ├── src ├── Makevars └── Makevars.win ├── vignettes ├── rmd │ ├── .install_extras │ ├── figures │ │ ├── bootstrap.pdf │ │ ├── dist_graphs-1.pdf │ │ ├── function_annotation_cpp.png │ │ └── samplePkg-files-light-bg.png │ ├── getCurrentVersionsOfCitedPackages.R │ └── Makefile ├── Rcpp-FAQ.pdf ├── Rcpp-sugar.pdf ├── Rcpp-jss-2011.pdf ├── Rcpp-modules.pdf ├── Rcpp-package.pdf ├── Rcpp-quickref.pdf ├── Rcpp-attributes.pdf ├── Rcpp-extending.pdf ├── Rcpp-libraries.pdf ├── Rcpp-introduction.pdf ├── Rcpp-FAQ.pdf.asis ├── Rcpp-sugar.pdf.asis ├── Rcpp-introduction.pdf.asis ├── Rcpp-modules.pdf.asis ├── Rcpp-package.pdf.asis ├── Rcpp-extending.pdf.asis ├── Rcpp-libraries.pdf.asis ├── Rcpp-quickref.pdf.asis ├── Rcpp-attributes.pdf.asis ├── Rcpp-jss-2011.pdf.asis ├── .gitignore └── Makefile ├── .Rinstignore ├── .gitattributes ├── man ├── populate.Rd ├── formals.Rd ├── DollarNames-methods.Rd ├── Rcpp-deprecated.Rd ├── Module.Rd ├── Rcpp-internal.Rd ├── CppObject-class.Rd ├── registerPlugin.Rd ├── CppField-class.Rd ├── RcppUnitTests.Rd ├── Module-class.Rd ├── CppOverloadedMethods-class.Rd ├── RcppLdFlags.Rd ├── CppConstructor-class.Rd ├── CppFunction-class.Rd ├── getRcppVersion.Rd ├── pluginsAttribute.Rd └── CppClass-class.Rd ├── Rcpp.Rproj ├── .gitignore ├── docker ├── run │ └── Dockerfile ├── ci-3.5 │ └── Dockerfile ├── ci-3.6 │ └── Dockerfile ├── ci-4.0 │ └── Dockerfile ├── ci-4.1 │ └── Dockerfile ├── ci-4.2 │ └── Dockerfile ├── ci-4.3 │ └── Dockerfile ├── ci-4.4 │ └── Dockerfile ├── ci-3.4 │ └── Dockerfile ├── ci-dev │ └── Dockerfile ├── ci │ └── Dockerfile └── plus │ └── Dockerfile ├── .editorconfig ├── .codecov.yml ├── .Rbuildignore ├── R ├── bib.R ├── zzz.R └── populate.R └── NAMESPACE /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: eddelbuettel 2 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceUser/src/config.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/debian/source/format: -------------------------------------------------------------------------------- 1 | 1.0 2 | -------------------------------------------------------------------------------- /src/Makevars: -------------------------------------------------------------------------------- 1 | PKG_CPPFLAGS = -I../inst/include/ 2 | 3 | -------------------------------------------------------------------------------- /src/Makevars.win: -------------------------------------------------------------------------------- 1 | PKG_CPPFLAGS = -I../inst/include/ 2 | 3 | -------------------------------------------------------------------------------- /vignettes/rmd/.install_extras: -------------------------------------------------------------------------------- 1 | Rcpp.bib 2 | rcpp.index.html 3 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/NAMESPACE: -------------------------------------------------------------------------------- 1 | useDynLib(testRcppPackage) 2 | import(Rcpp) 3 | -------------------------------------------------------------------------------- /vignettes/Rcpp-FAQ.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-FAQ.pdf -------------------------------------------------------------------------------- /vignettes/Rcpp-sugar.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-sugar.pdf -------------------------------------------------------------------------------- /vignettes/Rcpp-jss-2011.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-jss-2011.pdf -------------------------------------------------------------------------------- /vignettes/Rcpp-modules.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-modules.pdf -------------------------------------------------------------------------------- /vignettes/Rcpp-package.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-package.pdf -------------------------------------------------------------------------------- /vignettes/Rcpp-quickref.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-quickref.pdf -------------------------------------------------------------------------------- /.Rinstignore: -------------------------------------------------------------------------------- 1 | inst/doc/Makefile 2 | inst/doc/jss.bst 3 | inst/doc/RJournal.sty 4 | inst/unitTests/src 5 | -------------------------------------------------------------------------------- /vignettes/Rcpp-attributes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-attributes.pdf -------------------------------------------------------------------------------- /vignettes/Rcpp-extending.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-extending.pdf -------------------------------------------------------------------------------- /vignettes/Rcpp-libraries.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-libraries.pdf -------------------------------------------------------------------------------- /vignettes/Rcpp-introduction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/Rcpp-introduction.pdf -------------------------------------------------------------------------------- /vignettes/rmd/figures/bootstrap.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/rmd/figures/bootstrap.pdf -------------------------------------------------------------------------------- /vignettes/rmd/figures/dist_graphs-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/rmd/figures/dist_graphs-1.pdf -------------------------------------------------------------------------------- /inst/skeleton/rcpp_hello_world.R: -------------------------------------------------------------------------------- 1 | 2 | rcpp_hello_world <- function() { 3 | .Call("rcpp_hello_world", PACKAGE = "@PKG@") 4 | } 5 | 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ChangeLog merge=union 2 | inst/NEWS.Rd merge=union 3 | 4 | # gitattribute override for linguist 5 | *.h linguist-language=C++ 6 | -------------------------------------------------------------------------------- /vignettes/rmd/figures/function_annotation_cpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/rmd/figures/function_annotation_cpp.png -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/NAMESPACE: -------------------------------------------------------------------------------- 1 | useDynLib(testRcppModule, .registration=TRUE) 2 | exportPattern("^[[:alpha:]]+") 3 | import(Rcpp,methods) 4 | 5 | -------------------------------------------------------------------------------- /vignettes/rmd/figures/samplePkg-files-light-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/vignettes/rmd/figures/samplePkg-files-light-bg.png -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/R/rcpp_hello_world.R: -------------------------------------------------------------------------------- 1 | rcpp_hello_world <- function() { 2 | .Call("rcpp_hello_world", PACKAGE = "testRcppPackage") 3 | } 4 | -------------------------------------------------------------------------------- /inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1.diff.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1.diff.gz -------------------------------------------------------------------------------- /inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1_i386.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1_i386.deb -------------------------------------------------------------------------------- /inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1_amd64.deb -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/R/rcpp_hello_world.R: -------------------------------------------------------------------------------- 1 | 2 | rcpp_hello_world <- function(){ 3 | .Call("rcpp_hello_world_cpp", PACKAGE = "testRcppClass") 4 | } 5 | 6 | -------------------------------------------------------------------------------- /inst/tinytest/bin/i386/r-cran-testrcpppackage_0.1.0-1_i386.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/inst/tinytest/bin/i386/r-cran-testrcpppackage_0.1.0-1_i386.deb -------------------------------------------------------------------------------- /inst/tinytest/testRcppAttributePackage/NAMESPACE: -------------------------------------------------------------------------------- 1 | useDynLib(testRcppAttributePackage, .registration=TRUE) 2 | importFrom(Rcpp, evalCpp) 3 | exportPattern("^[[:alpha:]]+") 4 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/R/rcpp_hello_world.R: -------------------------------------------------------------------------------- 1 | 2 | rcpp_hello_world <- function(){ 3 | .Call( "rcpp_hello_world_cpp", PACKAGE = "testRcppModule" ) 4 | } 5 | 6 | -------------------------------------------------------------------------------- /inst/tinytest/bin/amd64/r-cran-testrcpppackage_0.1.0-1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RcppCore/Rcpp/HEAD/inst/tinytest/bin/amd64/r-cran-testrcpppackage_0.1.0-1_amd64.deb -------------------------------------------------------------------------------- /inst/examples/Attributes/sourceCpp.R: -------------------------------------------------------------------------------- 1 | 2 | library(Rcpp) 3 | 4 | sourceCpp("Export.cpp") 5 | fibonacci(5) 6 | 7 | 8 | sourceCpp("Depends.cpp") 9 | fastLm(c(1,2,3), matrix(3,3)) 10 | 11 | -------------------------------------------------------------------------------- /vignettes/Rcpp-FAQ.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-FAQ} 2 | %\VignetteKeywords{Rcpp, FAQ, R, Cpp} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /inst/examples/OpenMP/check.R: -------------------------------------------------------------------------------- 1 | 2 | dyn.load("piWithInterrupts.so") 3 | #res <- .Call("PiLeibniz", n=1e9, frequency=1e6) 4 | res <- .Call("PiLeibniz", n=1e9, frequency=1e6) 5 | print(res, digits=10) 6 | -------------------------------------------------------------------------------- /vignettes/Rcpp-sugar.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-sugar} 2 | %\VignetteKeywords{Rcpp, sugar, R, Cpp} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /vignettes/Rcpp-introduction.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-introduction} 2 | %\VignetteKeywords{Rcpp, R, Cpp} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /vignettes/Rcpp-modules.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-modules} 2 | %\VignetteKeywords{Rcpp, modules, R, Cpp} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /vignettes/Rcpp-package.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-package} 2 | %\VignetteKeywords{Rcpp, package, R, Cpp} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /vignettes/Rcpp-extending.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-extending} 2 | %\VignetteKeywords{Rcpp, extending, R, Cpp} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /vignettes/Rcpp-libraries.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-libraries} 2 | %\VignetteKeywords{Rcpp, Package, Library} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /vignettes/Rcpp-quickref.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-quickref} 2 | %\VignetteKeywords{Rcpp, quickref, R, Cpp} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /vignettes/Rcpp-attributes.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-attributes} 2 | %\VignetteKeywords{Rcpp, attributes, R, Cpp} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /inst/include/Rcpp/storage/storage.h: -------------------------------------------------------------------------------- 1 | #ifndef Rcpp_storage_storage_h 2 | #define Rcpp_storage_storage_h 3 | 4 | #include 5 | #include 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/src/rcpp_hello_world.h: -------------------------------------------------------------------------------- 1 | #ifndef _testRcppModule_RCPP_HELLO_WORLD_H 2 | #define _testRcppModule_RCPP_HELLO_WORLD_H 3 | 4 | #include 5 | 6 | RcppExport SEXP rcpp_hello_world_cpp() ; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/src/rcpp_hello_world.h: -------------------------------------------------------------------------------- 1 | #ifndef _testRcppModule_RCPP_HELLO_WORLD_H 2 | #define _testRcppModule_RCPP_HELLO_WORLD_H 3 | 4 | #include 5 | 6 | RcppExport SEXP rcpp_hello_world_cpp() ; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /vignettes/Rcpp-jss-2011.pdf.asis: -------------------------------------------------------------------------------- 1 | %\VignetteIndexEntry{Rcpp-JSS-2011} 2 | %\VignetteKeywords{Rcpp, foreign function interface, .Call, C++, R} 3 | %\VignettePackage{Rcpp} 4 | %\VignetteEncoding{UTF-8} 5 | %\VignetteEngine{Rcpp::asis} 6 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/NAMESPACE: -------------------------------------------------------------------------------- 1 | useDynLib(testRcppClass, .registration=TRUE) 2 | import(Rcpp,methods) 3 | 4 | export(genWorld, stdNumeric, rcpp_hello_world, 5 | bar, foo, baz, baz1) 6 | 7 | exportClass(RcppClassWorld, stdNumeric)#, NumEx) 8 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | Rcpp-*.aux 2 | Rcpp-*.out 3 | Rcpp-*.toc 4 | Rcpp-*.bbl 5 | Rcpp-*.blg 6 | Rcpp-*.log 7 | Rcpp-*.tex 8 | unitTests-results/ 9 | rmd/figures/bootstrap.pdf 10 | rmd/OLDbackup 11 | rmd/*_cache 12 | rmd/*.pdf 13 | rmd/*.cls 14 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceUser/NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(peek_flag) 4 | export(reset_flags) 5 | export(use_cpp_interface) 6 | importFrom(Rcpp,sourceCpp) 7 | useDynLib(testRcppInterfaceUser, .registration = TRUE) 8 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceExporter/NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(peek_flag) 4 | export(reset_flags) 5 | export(test_cpp_interface) 6 | importFrom(Rcpp,sourceCpp) 7 | useDynLib(testRcppInterfaceExporter, .registration = TRUE) 8 | -------------------------------------------------------------------------------- /inst/tinytest/cpp/attributes.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __RCPP_UNITTESTS_ATTRIBUTES__ 3 | #define __RCPP_UNITTESTS_ATTRIBUTES__ 4 | 5 | /* 6 | * dummy header used to test that local includes for sourceCpp are working 7 | */ 8 | 9 | #endif // __RCPP_UNITTESTS_ATTRIBUTES__ 10 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # debian/rules file for the Debian/GNU Linux testRcppPackage package 4 | # Copyright 2003 - 2014 by Dirk Eddelbuettel 5 | 6 | include /usr/share/R/debian/r-cran.mk 7 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/src/rcpp_hello_world.h: -------------------------------------------------------------------------------- 1 | #ifndef _testRcppPackage_RCPP_HELLO_WORLD_H 2 | #define _testRcppPackage_RCPP_HELLO_WORLD_H 3 | 4 | #include 5 | 6 | RcppExport SEXP rcpp_hello_world() ; 7 | RcppExport SEXP hello_world_ex() ; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /inst/examples/Misc/piSugar.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | using namespace Rcpp; 5 | 6 | // [[Rcpp::export]] 7 | double piSugar(const int N) { 8 | NumericVector x = runif(N); 9 | NumericVector y = runif(N); 10 | NumericVector d = sqrt(x*x + y*y); 11 | return 4.0 * sum(d < 1.0) / N; 12 | } 13 | -------------------------------------------------------------------------------- /inst/skeleton/rcpp_hello_world.Rd: -------------------------------------------------------------------------------- 1 | \name{rcpp_hello_world} 2 | \alias{rcpp_hello_world} 3 | \docType{package} 4 | \title{ 5 | Simple function using Rcpp 6 | } 7 | \description{ 8 | Simple function using Rcpp 9 | } 10 | \usage{ 11 | rcpp_hello_world() 12 | } 13 | \examples{ 14 | \dontrun{ 15 | rcpp_hello_world() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/man/rcpp_hello_world.Rd: -------------------------------------------------------------------------------- 1 | \name{rcpp_hello_world} 2 | \alias{rcpp_hello_world} 3 | \docType{package} 4 | \title{ 5 | Simple function using Rcpp 6 | } 7 | \description{ 8 | Simple function using Rcpp 9 | } 10 | \usage{ 11 | rcpp_hello_world() 12 | } 13 | \examples{ 14 | \dontrun{ 15 | rcpp_hello_world() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /inst/skeleton/rcpp_hello_world.cpp: -------------------------------------------------------------------------------- 1 | #include "rcpp_hello_world.h" 2 | 3 | SEXP rcpp_hello_world(){ 4 | using namespace Rcpp ; 5 | 6 | CharacterVector x = CharacterVector::create( "foo", "bar" ) ; 7 | NumericVector y = NumericVector::create( 0.0, 1.0 ) ; 8 | List z = List::create( x, y ) ; 9 | 10 | return z ; 11 | } 12 | -------------------------------------------------------------------------------- /inst/tinytest/cpp/Exceptions_nocall.cpp: -------------------------------------------------------------------------------- 1 | #define RCPP_DEFAULT_INCLUDE_CALL false 2 | #include 3 | using namespace Rcpp; 4 | 5 | // [[Rcpp::export]] 6 | void Rcpp_exception(){ 7 | throw Rcpp::exception("ouch"); 8 | } 9 | 10 | // [[Rcpp::export]] 11 | void eval_error_no_call(){ 12 | Rcpp_eval(Rf_lang1(Rf_install("ouch")), R_EmptyEnv); 13 | } 14 | -------------------------------------------------------------------------------- /inst/include/Rcpp/traits/enable_if.h: -------------------------------------------------------------------------------- 1 | #ifndef RCPP_TRAITS_ENABLE_IF_H 2 | #define RCPP_TRAITS_ENABLE_IF_H 3 | 4 | namespace Rcpp { 5 | namespace traits { 6 | 7 | template 8 | struct enable_if {}; 9 | 10 | template 11 | struct enable_if { 12 | typedef T type; 13 | }; 14 | 15 | } 16 | } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceExporter/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: testRcppInterfaceExporter 2 | Title: Exports c++ function via the cpp interface 3 | Version: 0.1.0 4 | Authors@R: 'Lionel Henry [aut, cre]' 5 | Description: The API package. 6 | Depends: 7 | R (>= 3.1.0) 8 | Imports: 9 | Rcpp 10 | LinkingTo: 11 | Rcpp 12 | License: GPL-3 13 | -------------------------------------------------------------------------------- /inst/skeleton/zzz.R: -------------------------------------------------------------------------------- 1 | 2 | ## For R 2.15.1 and later the approach shown here works (as opposed to the now removed 3 | ## and long-deprecated `loadRcppModules()`. Note that calling loadModule() triggers 4 | ## a load action, so this does not have to be placed in .onLoad() or evalqOnLoad(). 5 | loadModule("NumEx", TRUE) 6 | loadModule("yada", TRUE) 7 | loadModule("stdVector", TRUE) 8 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/src/rcpp_hello_world.cpp: -------------------------------------------------------------------------------- 1 | #include "rcpp_hello_world.h" 2 | 3 | SEXP rcpp_hello_world_cpp(){ 4 | using namespace Rcpp ; 5 | 6 | CharacterVector x = CharacterVector::create( "foo", "bar" ) ; 7 | NumericVector y = NumericVector::create( 0.0, 1.0 ) ; 8 | List z = List::create( x, y ) ; 9 | 10 | return z ; 11 | } 12 | -------------------------------------------------------------------------------- /inst/skeleton/rcpp_hello_world_attributes.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | using namespace Rcpp; 4 | 5 | // [[Rcpp::export]] 6 | List rcpp_hello_world() { 7 | 8 | CharacterVector x = CharacterVector::create( "foo", "bar" ) ; 9 | NumericVector y = NumericVector::create( 0.0, 1.0 ) ; 10 | List z = List::create( x, y ) ; 11 | 12 | return z ; 13 | } 14 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/man/rcpp_hello_world.Rd: -------------------------------------------------------------------------------- 1 | \name{rcpp_hello_world} 2 | \alias{rcpp_hello_world} 3 | \alias{rcpp_hello_world_cpp} 4 | \docType{package} 5 | \title{ 6 | Simple function using Rcpp 7 | } 8 | \description{ 9 | Simple function using Rcpp 10 | } 11 | \usage{ 12 | rcpp_hello_world() 13 | } 14 | \examples{ 15 | \dontrun{ 16 | rcpp_hello_world() 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/src/rcpp_hello_world.cpp: -------------------------------------------------------------------------------- 1 | #include "rcpp_hello_world.h" 2 | 3 | SEXP rcpp_hello_world_cpp(){ 4 | using namespace Rcpp ; 5 | 6 | CharacterVector x = CharacterVector::create( "foo", "bar" ) ; 7 | NumericVector y = NumericVector::create( 0.0, 1.0 ) ; 8 | List z = List::create( x, y ) ; 9 | 10 | return z ; 11 | } 12 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/R/zzz.R: -------------------------------------------------------------------------------- 1 | ## For R 2.15.1 and later the approach shown here works (as opposed to the now removed 2 | ## and long-deprecated `loadRcppModules()`. Note that calling loadModule() triggers 3 | ## a load action, so this does not have to be placed in .onLoad() or evalqOnLoad(). 4 | loadModule("RcppModuleNumEx", TRUE) 5 | loadModule("RcppModuleWorld", TRUE) 6 | loadModule("stdVector", TRUE) 7 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceUser/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: testRcppInterfaceUser 2 | Title: Calls exported c++ function of testRcppInterfaceExporter 3 | Version: 0.1.0 4 | Authors@R: 'Lionel Henry [aut, cre]' 5 | Description: The client package. 6 | Depends: 7 | R (>= 3.1.0) 8 | Imports: 9 | Rcpp 10 | LinkingTo: 11 | testRcppInterfaceExporter, 12 | Rcpp 13 | License: GPL-3 14 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/debian/changelog: -------------------------------------------------------------------------------- 1 | r-cran-testrcpppackage (0.1.0-1) unstable; urgency=low 2 | 3 | * Initial version 4 | 5 | * debian/control: Remove (Build-)Depends: on r-cran-rcpp as this package is 6 | internal and just used for testing from source when the packaged R binary 7 | may not be installed 8 | 9 | -- Dirk Eddelbuettel Fri, 03 Oct 2014 08:25:46 -0500 10 | -------------------------------------------------------------------------------- /man/populate.Rd: -------------------------------------------------------------------------------- 1 | \name{populate} 2 | \alias{populate} 3 | \title{ 4 | Populates a namespace or an environment with the content of a module 5 | } 6 | \description{ 7 | Populates a namespace or an environment with the content of a module 8 | } 9 | \usage{ 10 | populate(module, env) 11 | } 12 | \arguments{ 13 | \item{module}{Rcpp module} 14 | \item{env}{environment or namespace} 15 | } 16 | \keyword{manip} 17 | 18 | -------------------------------------------------------------------------------- /Rcpp.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 4 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageInstallArgs: --no-multiarch --with-keep.source 20 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceExporter/inst/include/testRcppInterfaceExporter.h: -------------------------------------------------------------------------------- 1 | // Generated by using Rcpp::compileAttributes() -> do not edit by hand 2 | // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 3 | 4 | #ifndef RCPP_testRcppInterfaceExporter_H_GEN_ 5 | #define RCPP_testRcppInterfaceExporter_H_GEN_ 6 | 7 | #include "testRcppInterfaceExporter_RcppExports.h" 8 | 9 | #endif // RCPP_testRcppInterfaceExporter_H_GEN_ 10 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppAttributePackage/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: testRcppAttributePackage 2 | Type: Package 3 | Title: Tests the signature attribute and other attributes in package compilation 4 | Version: 1.0 5 | Date: 2021-10-09 6 | Author: Travers Ching 7 | Maintainer: Dirk Eddelbuettel 8 | Description: Small test package part of Rcpp unit tests 9 | License: GPL (>= 2) 10 | Imports: Rcpp (>= 1.0.7) 11 | LinkingTo: Rcpp 12 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: testRcppPackage 2 | Type: Package 3 | Title: Small Test Package for Rcpp and Part of Rcpp Unit Tests 4 | Version: 0.1.0 5 | Date: 2014-11-02 6 | Author: Dirk Eddelbuettel and Romain Francois 7 | Maintainer: Dirk Eddelbuettel 8 | Description: Small test package uses as part of Rcpp unit tests 9 | License: GPL (>= 2) 10 | LazyLoad: yes 11 | Imports: Rcpp 12 | LinkingTo: Rcpp 13 | -------------------------------------------------------------------------------- /man/formals.Rd: -------------------------------------------------------------------------------- 1 | \name{formals<--methods} 2 | \docType{methods} 3 | \alias{formals<--methods} 4 | \alias{formals<-,C++Function-method} 5 | \title{Set the formal arguments of a C++ function} 6 | \description{ 7 | Set the formal arguments of a C++ function 8 | } 9 | \section{Methods}{ 10 | \describe{ 11 | 12 | \item{\code{signature(fun = "C++Function")}}{ 13 | Set the formal arguments of a C++ function 14 | } 15 | }} 16 | \keyword{methods} 17 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceUser/R/user.R: -------------------------------------------------------------------------------- 1 | #' @useDynLib testRcppInterfaceUser, .registration = TRUE 2 | #' @importFrom Rcpp sourceCpp 3 | NULL 4 | 5 | flags <- new.env(parent = emptyenv()) 6 | 7 | #' @export 8 | reset_flags <- function() { 9 | flags$cpp_interface_downstream <- FALSE 10 | } 11 | .onLoad <- function(lib, pkg) { 12 | reset_flags() 13 | } 14 | 15 | #' @export 16 | peek_flag <- function(name) { 17 | flags[[name]] 18 | } 19 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceExporter/R/exporter.R: -------------------------------------------------------------------------------- 1 | #' @useDynLib testRcppInterfaceExporter, .registration = TRUE 2 | #' @importFrom Rcpp sourceCpp 3 | NULL 4 | 5 | flags <- new.env(parent = emptyenv()) 6 | 7 | #' @export 8 | reset_flags <- function() { 9 | flags$cpp_interface_upstream <- FALSE 10 | } 11 | .onLoad <- function(lib, pkg) { 12 | reset_flags() 13 | } 14 | 15 | #' @export 16 | peek_flag <- function(name) { 17 | flags[[name]] 18 | } 19 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/debian/control: -------------------------------------------------------------------------------- 1 | Source: r-cran-testrcpppackage 2 | Section: gnu-r 3 | Priority: optional 4 | Maintainer: Dirk Eddelbuettel 5 | Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.1.1), cdbs 6 | Standards-Version: 3.9.6 7 | 8 | Package: r-cran-testrcpppackage 9 | Architecture: any 10 | Depends: ${shlibs:Depends}, ${misc:Depends}, ${R:Depends} 11 | Description: GNU R package to test Rcpp during Unit Tests 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | inst/lib 2 | .Rproj.user 3 | src/*.o 4 | src/*.so 5 | src/*.dll 6 | src/symbols.rds 7 | .Rhistory 8 | .RData 9 | .DS_Store 10 | 11 | ## QtCreator 12 | Rcpp.pro 13 | Rcpp.pro.user 14 | *.autosave 15 | .#* 16 | 17 | *.tar.gz 18 | 19 | vignettes/*_cache 20 | 21 | ## GNU global 22 | GPATH 23 | GRTAGS 24 | GTAGS 25 | 26 | ## 27 | local/ 28 | 29 | ## docker helpers 30 | docker/*sh 31 | docker/*/*.sh 32 | 33 | ## Emacs 34 | *~ 35 | 36 | ## VSCode 37 | .vscode/ 38 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceExporter/src/exporter.cpp: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | #include "unwound.h" 5 | 6 | // [[Rcpp::interfaces(r, cpp)]] 7 | 8 | //' @export 9 | // [[Rcpp::export]] 10 | SEXP test_cpp_interface(SEXP x, bool fast = false) { 11 | unwound_t stack_obj("cpp_interface_upstream"); 12 | if (fast) { 13 | return Rcpp::Rcpp_fast_eval(x, R_GlobalEnv); 14 | } else { 15 | return Rcpp::Rcpp_eval(x, R_GlobalEnv); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceUser/src/user.cpp: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "unwound.h" 7 | 8 | 9 | //' @export 10 | // [[Rcpp::export]] 11 | SEXP use_cpp_interface(SEXP x, bool fast = false) { 12 | unwound_t stack_obj("cpp_interface_downstream"); 13 | Rcpp::RObject out = testRcppInterfaceExporter::test_cpp_interface(x, fast); 14 | Rcpp::Rcout << "Wrapping up" << std::endl; 15 | return out; 16 | } 17 | -------------------------------------------------------------------------------- /docker/run/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM rcpp/ci 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | ## If on CRAN, install the latest version from CRAN 10 | RUN install.r Rcpp 11 | 12 | ## Alternatively, install from Github (after first installing remotes) 13 | #RUN install.r remotes && installGithub.r RcppCore/Rcpp 14 | 15 | CMD ["bash"] 16 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/overhead.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -f *.o *.so 4 | 5 | # build the shared library for the C variant 6 | R CMD SHLIB overhead_2.c 7 | 8 | # build the shared library for the C++ variant 9 | # we have to let R know where the Rcpp header and library are 10 | export PKG_CPPFLAGS=`Rscript -e "Rcpp:::CxxFlags()"` 11 | export PKG_LIBS=`Rscript -e "Rcpp:::LdFlags()"` 12 | R CMD SHLIB overhead_1.cpp 13 | 14 | # call R so that we get an interactive session 15 | Rscript overhead.r 16 | 17 | -------------------------------------------------------------------------------- /inst/include/Rcpp/traits/is_bool.h: -------------------------------------------------------------------------------- 1 | #ifndef Rcpp__traits__is_bool__h 2 | #define Rcpp__traits__is_bool__h 3 | 4 | namespace Rcpp{ namespace traits { 5 | 6 | template 7 | struct is_bool 8 | : public false_type { }; 9 | 10 | template<> 11 | struct is_bool 12 | : public true_type { }; 13 | 14 | template<> 15 | struct is_bool 16 | : public true_type { }; 17 | 18 | template<> 19 | struct is_bool 20 | : public true_type { }; 21 | 22 | }} 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceExporter/R/RcppExports.R: -------------------------------------------------------------------------------- 1 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand 2 | # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 3 | 4 | #' @export 5 | test_cpp_interface <- function(x, fast = FALSE) { 6 | .Call(`_testRcppInterfaceExporter_test_cpp_interface`, x, fast) 7 | } 8 | 9 | # Register entry points for exported C++ functions 10 | methods::setLoadAction(function(ns) { 11 | .Call(`_testRcppInterfaceExporter_RcppExport_registerCCallable`) 12 | }) 13 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/tests/modules.R: -------------------------------------------------------------------------------- 1 | library(testRcppModule) 2 | 3 | v <- new(vec) 4 | data <- 1:10 5 | v$assign(data) 6 | v[[3]] <- v[[3]] + 1 7 | 8 | data[[4]] <- data[[4]] +1 9 | 10 | stopifnot(identical(all.equal(v$as.vector(), data), TRUE)) 11 | 12 | ## a few function calls 13 | 14 | stopifnot(all.equal(bar(2), 4)) 15 | stopifnot(all.equal(foo(2,3), 6)) 16 | 17 | ## properties (at one stage this seqfaulted, so beware) 18 | nn <- new(RcppModuleNum) 19 | nn$x <- pi 20 | stopifnot(all.equal(nn$x, pi)) 21 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/loopmacro.h: -------------------------------------------------------------------------------- 1 | 2 | #define LOOPMACRO_C(name) \ 3 | SEXP name##__loop(SEXP n_, SEXP a, SEXP b){ \ 4 | int n = INTEGER(n_)[0] ; \ 5 | SEXP res = R_NilValue ; \ 6 | for( int i=0; i= 2)\cr 18 | LazyLoad: \tab yes\cr 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | # Matches multiple files with brace expansion notation 13 | # 4 space indentation 14 | [*.{c,cpp,h,hpp,R,r}] 15 | indent_style = space 16 | indent_size = 4 17 | 18 | # Tab indentation (no size specified) 19 | [Makefile] 20 | indent_style = tab 21 | 22 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/man/testRcppClass-package.Rd: -------------------------------------------------------------------------------- 1 | \name{testRcppClass-package} 2 | \alias{testRcppClass-package} 3 | \alias{testRcppClass} 4 | \docType{package} 5 | \title{ 6 | Dummy package part of Rcpp unit testing 7 | } 8 | \description{ 9 | Dummy package part of Rcpp unit testing 10 | } 11 | \details{ 12 | \tabular{ll}{ 13 | Package: \tab testRcppClass\cr 14 | Type: \tab Package\cr 15 | Version: \tab 1.0\cr 16 | Date: \tab 2010-09-06\cr 17 | License: \tab GPL (>=2)\cr 18 | LazyLoad: \tab yes\cr 19 | } 20 | } 21 | \keyword{ package } 22 | 23 | -------------------------------------------------------------------------------- /docker/ci-3.5/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM r-base:3.5.3 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends git \ 11 | && install.r inline pkgKitten rbenchmark tinytest 12 | 13 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 14 | ENV _R_CHECK_TESTS_NLINES_ 0 15 | ENV RunAllRcppTests yes 16 | 17 | CMD ["bash"] 18 | -------------------------------------------------------------------------------- /docker/ci-3.6/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM r-base:3.6.3 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends git \ 11 | && install.r inline pkgKitten rbenchmark tinytest 12 | 13 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 14 | ENV _R_CHECK_TESTS_NLINES_ 0 15 | ENV RunAllRcppTests yes 16 | 17 | CMD ["bash"] 18 | -------------------------------------------------------------------------------- /docker/ci-4.0/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM r-base:4.0.5 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends git \ 11 | && install.r inline pkgKitten rbenchmark tinytest 12 | 13 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 14 | ENV _R_CHECK_TESTS_NLINES_ 0 15 | ENV RunAllRcppTests yes 16 | 17 | CMD ["bash"] 18 | -------------------------------------------------------------------------------- /docker/ci-4.1/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM r-base:4.1.3 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends git \ 11 | && install.r inline pkgKitten rbenchmark tinytest 12 | 13 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 14 | ENV _R_CHECK_TESTS_NLINES_ 0 15 | ENV RunAllRcppTests yes 16 | 17 | CMD ["bash"] 18 | -------------------------------------------------------------------------------- /docker/ci-4.2/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM r-base:4.2.3 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends git \ 11 | && install.r inline pkgKitten rbenchmark tinytest 12 | 13 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 14 | ENV _R_CHECK_TESTS_NLINES_ 0 15 | ENV RunAllRcppTests yes 16 | 17 | CMD ["bash"] 18 | -------------------------------------------------------------------------------- /docker/ci-4.3/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM r-base:4.3.3 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends git \ 11 | && install.r inline pkgKitten rbenchmark tinytest 12 | 13 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 14 | ENV _R_CHECK_TESTS_NLINES_ 0 15 | ENV RunAllRcppTests yes 16 | 17 | CMD ["bash"] 18 | -------------------------------------------------------------------------------- /docker/ci-4.4/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM r-base:4.4.3 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends git \ 11 | && install.r inline pkgKitten rbenchmark tinytest 12 | 13 | ENV _R_CHECK_FORCE_SUGGESTS_=FALSE 14 | ENV _R_CHECK_TESTS_NLINES_=0 15 | ENV RunAllRcppTests=yes 16 | 17 | CMD ["bash"] 18 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/man/testRcppModule-package.Rd: -------------------------------------------------------------------------------- 1 | \name{testRcppModule-package} 2 | \alias{testRcppModule-package} 3 | \alias{testRcppModule} 4 | \docType{package} 5 | \title{ 6 | Dummy package part of Rcpp unit testing 7 | } 8 | \description{ 9 | Dummy package part of Rcpp unit testing 10 | } 11 | \details{ 12 | \tabular{ll}{ 13 | Package: \tab testRcppModule\cr 14 | Type: \tab Package\cr 15 | Version: \tab 1.0\cr 16 | Date: \tab 2010-09-06\cr 17 | License: \tab GPL (>=2)\cr 18 | LazyLoad: \tab yes\cr 19 | } 20 | } 21 | \keyword{ package } 22 | 23 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: testRcppModule 2 | Type: Package 3 | Title: Some Test Examples using Rcpp with the Module Feature 4 | Version: 0.1 5 | Date: 2010-09-06 6 | Author: John Chambers 7 | Maintainer: John Chambers 8 | Description: Some examples taken (and perhaps modified) from the Rcpp Modules documentation. 9 | License: GPL (>=2) 10 | LazyLoad: yes 11 | Depends: methods, Rcpp (>= 0.8.5) 12 | LinkingTo: Rcpp 13 | RcppModules: RcppModuleWorld, stdVector, NumEx 14 | Packaged: 2010-09-09 18:42:28 UTC; jmc 15 | 16 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | coverage: 3 | status: 4 | project: 5 | default: 6 | target: 70% # the (on purpose low) required coverage value 7 | threshold: 2% # the permitted delta in hitting the target 8 | patch: 9 | default: 10 | target: 0% # the (on purpose low) required coverage value 11 | 12 | # layout: "header, diff, tree, changes" 13 | # behavior: default 14 | # require_changes: false # if true: only post the comment if coverage changes 15 | # branches: null 16 | # flags: null 17 | # paths: null 18 | -------------------------------------------------------------------------------- /docker/ci-3.4/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM r-base:3.4.4 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends \ 11 | git \ 12 | && install.r inline pkgKitten rbenchmark tinytest 13 | 14 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 15 | ENV _R_CHECK_TESTS_NLINES_ 0 16 | ENV RunAllRcppTests yes 17 | 18 | CMD ["bash"] 19 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppPackage/src/rcpp_hello_world.cpp: -------------------------------------------------------------------------------- 1 | #include "rcpp_hello_world.h" 2 | 3 | SEXP rcpp_hello_world(){ 4 | using namespace Rcpp ; 5 | CharacterVector x = CharacterVector::create( "foo", "bar" ) ; 6 | NumericVector y = NumericVector::create( 0.0, 1.0 ) ; 7 | List z = List::create( x, y ) ; 8 | return z ; 9 | } 10 | 11 | SEXP hello_world_ex(){ 12 | try{ 13 | throw std::range_error( "boom" ) ; 14 | } catch( std::exception& __ex__ ){ 15 | forward_exception_to_r( __ex__ ) ; 16 | } 17 | return R_NilValue ; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /inst/examples/Misc/piBySimulation.r: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env r 2 | 3 | library(Rcpp) 4 | library(rbenchmark) 5 | 6 | piR <- function(N) { 7 | x <- runif(N) 8 | y <- runif(N) 9 | d <- sqrt(x^2 + y^2) 10 | return(4 * sum(d < 1.0) / N) 11 | } 12 | 13 | sourceCpp("piSugar.cpp") 14 | 15 | N <- 1e6 16 | 17 | set.seed(42) 18 | resR <- piR(N) 19 | 20 | set.seed(42) 21 | resCpp <- piSugar(N) 22 | 23 | ## important: check results are identical with RNG seeded 24 | stopifnot(identical(resR, resCpp)) 25 | 26 | res <- benchmark(piR(N), piSugar(N), order="relative") 27 | 28 | print(res[,1:4]) 29 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/tests/classes.R: -------------------------------------------------------------------------------- 1 | library(testRcppClass) 2 | 3 | v <- stdNumeric$new() 4 | data <- 1:10 5 | v$assign(data) 6 | v$set(3L, v$at(3L) + 1) 7 | 8 | data[[4]] <- data[[4]] +1 9 | 10 | stopifnot(identical(all.equal(v$as.vector(), data), TRUE)) 11 | 12 | ## a few function calls 13 | 14 | stopifnot(all.equal(bar(2), 4)) 15 | stopifnot(all.equal(foo(2,3), 6)) 16 | 17 | ## Uncomment this when a C++Class can be found w/o extracting from module 18 | ## as in commented code in R/load.R 19 | 20 | ## nn <- new("NumEx") 21 | ## nn$x <- pi 22 | ## stopifnot(all.equal(nn$x, pi)) 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | debian 2 | inst/doc/html 3 | inst/doc/latex 4 | inst/doc/man 5 | inst/doc/jss.bst 6 | vignettes/jss.bst 7 | ^.*\.Rproj$ 8 | ^\.Rproj\.user$ 9 | vignettes/notyet 10 | doxyfile 11 | \.travis\.yml 12 | \.dir-locals\.el 13 | \.clang_format 14 | vignettes/getCurrentVersionsOfCitedPackages.R 15 | ^Contributing.md$ 16 | ^\.codecov\.yml$ 17 | inst/include/Rcpp.h.new 18 | inst/include/Rcpp.h.old 19 | LICENSE 20 | .*\.tar\.gz$ 21 | \.editorconfig 22 | docker 23 | ^GPATH 24 | ^GRTAGS 25 | ^GTAGS 26 | ^local 27 | vignettes/Makefile 28 | vignettes/rmd 29 | \.github 30 | ^issue.*\.md 31 | ^note.*\.md 32 | \.vscode 33 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | ### Pull Request Template for Rcpp 3 | 4 | Please explain the changes you want to apply to Rcpp, preferably in an issue ticket **before** you create a pull request. See the file [Contributing](https://github.com/RcppCore/Rcpp/blob/master/Contributing.md) and the other templates for details. 5 | 6 | #### Checklist 7 | 8 | - [ ] Code compiles correctly 9 | - [ ] `R CMD check` still passes all tests 10 | - [ ] Preferably, new tests were added which fail without the change 11 | - [ ] Document the changes by file in [ChangeLog](https://github.com/RcppCore/Rcpp/blob/master/ChangeLog) 12 | -------------------------------------------------------------------------------- /vignettes/rmd/getCurrentVersionsOfCitedPackages.R: -------------------------------------------------------------------------------- 1 | #!/usr/bin/r 2 | 3 | stopifnot(`Needs data.table` = requireNamespace("data.table", quietly = TRUE)) 4 | library(data.table) 5 | 6 | if (!file.exists("Rcpp.bib")) setwd("~/git/rcpp/vignettes/rmd") 7 | 8 | cmd <- "awk '/package=/ { print($5) }' Rcpp.bib | sed -e 's/\"//g' - | awk -F= '{print($2)}' | sed -e 's/,$//' - | sort -f | uniq" 9 | con <- pipe(cmd) 10 | pkgs <- readLines(con) 11 | close(con) 12 | 13 | pkg <- data.table(Package=pkgs) 14 | 15 | db <- data.table(tools::CRAN_package_db()) 16 | 17 | print(db[pkg, on="Package"][, .(Package, Version, Date, Title)]) 18 | -------------------------------------------------------------------------------- /man/DollarNames-methods.Rd: -------------------------------------------------------------------------------- 1 | \name{.DollarNames-methods} 2 | \docType{methods} 3 | \alias{.DollarNames-methods} 4 | \alias{.DollarNames,ANY-method} 5 | \alias{.DollarNames,C++Object-method} 6 | \alias{.DollarNames,Module-method} 7 | \title{ completion } 8 | \description{ 9 | completion 10 | } 11 | \section{Methods}{ 12 | \describe{ 13 | 14 | \item{\code{signature(x = "ANY")}}{} 15 | 16 | \item{\code{signature(x = "C++Object")}}{ 17 | completes fields and methods of C++ objects 18 | } 19 | 20 | \item{\code{signature(x = "Module")}}{ 21 | completes functions and classes of modules 22 | } 23 | }} 24 | \keyword{methods} 25 | 26 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/overhead_1.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 | 3 | // This is a rewrite of the 'Writing R Extensions' section 5.10.1 example 4 | 5 | #include 6 | // using namespace Rcpp ; 7 | 8 | SEXP overhead_cpp(SEXP a, SEXP b) { 9 | return R_NilValue ; 10 | } 11 | 12 | extern "C" void R_init_overhead_1(DllInfo *info){ 13 | 14 | R_CallMethodDef callMethods[] = { 15 | {"overhead_cpp", (DL_FUNC) &overhead_cpp, 2}, 16 | {NULL, NULL, 0} 17 | }; 18 | 19 | R_registerRoutines(info, NULL, callMethods, NULL, NULL); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/overhead_2.c: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 | 3 | // This is a rewrite of the 'Writing R Extensions' section 5.10.1 example 4 | #include 5 | #include 6 | #include 7 | 8 | SEXP overhead_c(SEXP a, SEXP b) { 9 | return R_NilValue ; 10 | } 11 | 12 | void R_init_overhead_2(DllInfo *info){ 13 | 14 | R_CallMethodDef callMethods[] = { 15 | {"overhead_c", (DL_FUNC) &overhead_c, 2}, 16 | {NULL, NULL, 0} 17 | }; 18 | 19 | R_registerRoutines(info, NULL, callMethods, NULL, NULL); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /man/Rcpp-deprecated.Rd: -------------------------------------------------------------------------------- 1 | \name{Rcpp-deprecated} 2 | \alias{Rcpp-deprecated} 3 | \title{Deprecated Functions in the Rcpp Package} 4 | \description{ 5 | These functions are provided for compatibility with older versions of the 6 | \pkg{Rcpp} package only, and may be removed in future versions. 7 | } 8 | \details{ 9 | \itemize{ 10 | \item \code{\link{LdFlags}} and \code{\link{RcppLdFlags}} are no 11 | longer required as no library is provided (or needed) by Rcpp (as it 12 | was up until release 0.10.1). 13 | } 14 | } 15 | \author{Dirk Eddelbuettel and Romain Francois} 16 | \keyword{programming} 17 | \keyword{interface} 18 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: testRcppClass 2 | Type: Package 3 | Title: Some Examples using Rcpp Classes and loadModule() 4 | Version: 0.1 5 | Date: 2012-04-06 6 | Author: John Chambers 7 | Maintainer: John Chambers 8 | Description: Some examples from the Rcpp Modules documentation, with 9 | load-time creation of classes that extend C++ classes and with 10 | explicit loading of some objects. 11 | License: GPL(>=2) 12 | LazyLoad: yes 13 | Depends: R (>= 2.15.0) 14 | Imports: Rcpp (>= 0.8.5), methods 15 | LinkingTo: Rcpp 16 | Packaged: 2012-04-14 18:42:28 UTC; jmc 17 | NeedsCompilation: yes 18 | -------------------------------------------------------------------------------- /inst/skeleton/Rcpp_modules_examples.Rd: -------------------------------------------------------------------------------- 1 | \name{Rcpp Modules Examples} 2 | \alias{Num} 3 | \alias{World} 4 | \alias{bar} 5 | \alias{bla} 6 | \alias{bla1} 7 | \alias{bla2} 8 | \alias{foo} 9 | \alias{vec} 10 | \alias{hello} 11 | \alias{Rcpp_Num-class} 12 | \alias{Rcpp_World-class} 13 | \alias{Rcpp_vec-class} 14 | \alias{C++Object-class} 15 | \title{ 16 | Functions and Objects created by Rcpp Modules Example 17 | } 18 | \description{ 19 | These function and objects are accessible from R via the Rcpp Modules mechanism 20 | which creates them based on the declaration in the C++ file. 21 | } 22 | \seealso{ 23 | The Rcpp Modules vignette. 24 | } -------------------------------------------------------------------------------- /docker/ci-dev/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM rocker/drd 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN rm -f /etc/apt/sources.list.d/experimental.list \ 10 | && apt update -y \ 11 | && apt install -y --no-install-recommends git \ 12 | && RDscript -e 'install.packages(c("codetools", "inline", "pkgKitten", "rbenchmark", "tinytest"))' 13 | 14 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 15 | ENV _R_CHECK_TESTS_NLINES_ 0 16 | ENV RunAllRcppTests yes 17 | 18 | CMD ["bash"] 19 | -------------------------------------------------------------------------------- /inst/prompt/module.Rd: -------------------------------------------------------------------------------- 1 | \name{NAME} 2 | \alias{NAME} 3 | \title{ 4 | Rcpp module: %% ~~ Name of the module ~~ 5 | } 6 | \description{ 7 | Rcpp module %% ~~ A concise description of the module ~~ 8 | } 9 | \details{ 10 | The module contains the following items: 11 | 12 | FUNCTIONS 13 | 14 | CLASSES 15 | } 16 | \source{ 17 | %% ~~ reference to a publication or URL ~~ 18 | %% ~~ perhaps a reference to the project page of the c++ code being exposed ~~ 19 | } 20 | \references{ 21 | %% ~~ possibly secondary sources and usages ~~ 22 | %% ~~ perhaps references to the C++ code that the module exposes ~~ 23 | } 24 | \examples{ 25 | show( NAME ) 26 | } 27 | \keyword{datasets} 28 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve10_cpp.h: -------------------------------------------------------------------------------- 1 | 2 | class Cache{ 3 | public: 4 | typedef double& proxy ; 5 | typedef double* iterator ; 6 | 7 | Cache( iterator data_) : data(data_){} 8 | 9 | inline proxy ref(int i){ return data[i] ; } 10 | inline proxy ref(int i) const { return data[i] ; } 11 | 12 | private: 13 | iterator data ; 14 | } ; 15 | 16 | class Vec { 17 | public: 18 | typedef double& proxy ; 19 | 20 | Vec( double* data_ ) : cache(data_){} 21 | inline proxy operator[]( int i){ return cache.ref(i) ; } 22 | inline proxy operator[]( int i) const { return cache.ref(i) ; } 23 | 24 | private: 25 | Cache cache ; 26 | } ; 27 | 28 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppInterfaceUser/src/unwound.h: -------------------------------------------------------------------------------- 1 | #ifndef UNWOUND_H 2 | #define UNWOUND_H 3 | 4 | 5 | #include 6 | 7 | #define PKG_NAME "testRcppInterfaceUser" 8 | 9 | struct unwound_t { 10 | unwound_t(std::string flag_) { 11 | flag = flag_; 12 | Rcpp::Rcout << "Initialising " << flag << std::endl; 13 | Rcpp::Environment ns = Rcpp::Environment::namespace_env(PKG_NAME); 14 | flags_env = ns["flags"]; 15 | flags_env[flag] = false; 16 | } 17 | ~unwound_t() { 18 | Rcpp::Rcout << "Unwinding " << flag << std::endl; 19 | flags_env[flag] = true; 20 | } 21 | 22 | std::string flag; 23 | Rcpp::Environment flags_env; 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve5_cpp.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 | 3 | // This is a rewrite of the 'Writing R Extensions' section 5.10.1 example 4 | 5 | #include 6 | using namespace Rcpp ; 7 | 8 | 9 | RcppExport SEXP convolve5cpp(SEXP a, SEXP b) { 10 | NumericVector xa(a); int n_xa = xa.size() ; 11 | NumericVector xb(b); int n_xb = xb.size() ; 12 | NumericVector xab(n_xa + n_xb - 1,0.0); 13 | 14 | Range r( 0, n_xb-1 ); 15 | for(int i=0; i 6 | 7 | #define PKG_NAME "testRcppInterfaceExporter" 8 | 9 | struct unwound_t { 10 | unwound_t(std::string flag_) { 11 | flag = flag_; 12 | Rcpp::Rcout << "Initialising " << flag << std::endl; 13 | Rcpp::Environment ns = Rcpp::Environment::namespace_env(PKG_NAME); 14 | flags_env = ns["flags"]; 15 | flags_env[flag] = false; 16 | } 17 | ~unwound_t() { 18 | Rcpp::Rcout << "Unwinding " << flag << std::endl; 19 | flags_env[flag] = true; 20 | } 21 | 22 | std::string flag; 23 | Rcpp::Environment flags_env; 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/man/Rcpp_modules_examples.Rd: -------------------------------------------------------------------------------- 1 | \name{Rcpp Modules Examples} 2 | \alias{RcppModuleNum} 3 | \alias{RcppModuleWorld} 4 | \alias{bar} 5 | \alias{bla} 6 | \alias{bla1} 7 | \alias{bla2} 8 | \alias{foo} 9 | \alias{vec} 10 | \alias{hello} 11 | \alias{Rcpp_RcppModuleNum-class} 12 | \alias{Rcpp_RcppModuleWorld-class} 13 | \alias{Rcpp_vec-class} 14 | \alias{C++Object-class} 15 | \title{ 16 | Functions and Objects created by Rcpp Modules Example 17 | } 18 | \description{ 19 | These function and objects are accessible from R via the Rcpp Modules mechanism 20 | which creates them based on the declaration in the C++ file. 21 | } 22 | \seealso{ 23 | The Rcpp Modules vignette. 24 | } -------------------------------------------------------------------------------- /inst/include/Rcpp/traits/index_sequence.h: -------------------------------------------------------------------------------- 1 | #ifndef RCPP_TRAITS_INDEX_SEQUENCE_H 2 | #define RCPP_TRAITS_INDEX_SEQUENCE_H 3 | 4 | namespace Rcpp { 5 | namespace traits { 6 | /** 7 | * C++11 implementations for index_sequence and make_index_sequence. 8 | * To avoid name conflicts or ambiguity when compiling with C++14 or later, 9 | * they should always be prefaced with `Rcpp::traits::` when used. 10 | */ 11 | template 12 | struct index_sequence {}; 13 | 14 | template 15 | struct make_index_sequence : make_index_sequence {}; 16 | 17 | template 18 | struct make_index_sequence<0, Is...> : index_sequence {}; 19 | } 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | ### Contributing to Rcpp 3 | 4 | Please see the file [Contributing](https://github.com/RcppCore/Rcpp/blob/master/Contributing.md) for details on 5 | 6 | - how to report an issue: a [Minimally Complete (and) Verifiable Example (MCVE)](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) helps a lot; 7 | - how to submit a pull request: post an issue first, get consensus about _what_ and _how_; 8 | - how to follow our (informal) coding style: simply do as other files do and do not invent a new style; 9 | - how to be nice and add [ChangeLog](https://github.com/RcppCore/Rcpp/blob/master/ChangeLog) and [NEWS.Rd](https://github.com/RcppCore/Rcpp/blob/master/ChangeLog). 10 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve3_cpp.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 | 3 | // This is a rewrite of the 'Writing R Extensions' section 5.10.1 example 4 | 5 | #include 6 | 7 | RcppExport SEXP convolve3cpp(SEXP a, SEXP b){ 8 | Rcpp::NumericVector xa(a); 9 | Rcpp::NumericVector xb(b); 10 | int n_xa = xa.size() ; 11 | int n_xb = xb.size() ; 12 | int nab = n_xa + n_xb - 1; 13 | Rcpp::NumericVector xab(nab); 14 | 15 | for (int i = 0; i < n_xa; i++) 16 | for (int j = 0; j < n_xb; j++) 17 | xab[i + j] += xa[i] * xb[j]; 18 | 19 | return xab ; 20 | } 21 | 22 | #include "loopmacro.h" 23 | LOOPMACRO_CPP(convolve3cpp) 24 | 25 | -------------------------------------------------------------------------------- /inst/skeleton/rcpp_hello_world.h: -------------------------------------------------------------------------------- 1 | #ifndef _@PKG@_RCPP_HELLO_WORLD_H 2 | #define _@PKG@_RCPP_HELLO_WORLD_H 3 | 4 | #include 5 | 6 | /* 7 | * note : RcppExport is an alias to `extern "C"` defined by Rcpp. 8 | * 9 | * It gives C calling convention to the rcpp_hello_world function so that 10 | * it can be called from .Call in R. Otherwise, the C++ compiler mangles the 11 | * name of the function and .Call cannot find it. 12 | * 13 | * It is only useful to use RcppExport when the function is intended to be called 14 | * by .Call. See the thread http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672 15 | * on Rcpp-devel for a misuse of RcppExport 16 | */ 17 | RcppExport SEXP rcpp_hello_world() ; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/src/Num.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | 3 | #include "rcpp_hello_world.h" 4 | 5 | class Num{ 6 | public: 7 | Num() : x(0.0), y(0){} ; 8 | 9 | double getX() { return x ; } 10 | void setX(double value){ x = value ; } 11 | 12 | int getY() { return y ; } 13 | 14 | private: 15 | double x ; 16 | int y ; 17 | }; 18 | 19 | RCPP_MODULE(NumEx){ 20 | using namespace Rcpp ; 21 | 22 | class_( "Num" ) 23 | 24 | .default_constructor() 25 | 26 | // read and write property 27 | .property( "x", &Num::getX, &Num::setX ) 28 | 29 | // read-only property 30 | .property( "y", &Num::getY ) 31 | ; 32 | } 33 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve11_cpp.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 | 3 | // This version uses nona to indicate that xb does not contain any missing 4 | // value. This is the assumption that all other versions do. 5 | 6 | #include 7 | using namespace Rcpp ; 8 | 9 | 10 | RcppExport SEXP convolve11cpp(SEXP a, SEXP b) { 11 | NumericVector xa(a); int n_xa = xa.size() ; 12 | NumericVector xb(b); int n_xb = xb.size() ; 13 | NumericVector xab(n_xa + n_xb - 1,0.0); 14 | 15 | Range r( 0, n_xb-1 ); 16 | for(int i=0; i 6 | 7 | using namespace Rcpp ; 8 | RcppExport SEXP convolve14cpp(SEXP a, SEXP b){ 9 | NumericVector xa(a), xb(b); 10 | int n_xa = xa.size() ; 11 | int n_xb = xb.size() ; 12 | int nab = n_xa + n_xb - 1; 13 | NumericVector xab(nab); 14 | Fast fa(xa), fb(xb), fab(xab) ; 15 | 16 | for (int i = 0; i < n_xa; i++) 17 | for (int j = 0; j < n_xb; j++) 18 | fab[i + j] += fa[i] * fb[j]; 19 | 20 | return xab ; 21 | } 22 | 23 | #include "loopmacro.h" 24 | LOOPMACRO_CPP(convolve14cpp) 25 | 26 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve7_c.c: -------------------------------------------------------------------------------- 1 | 2 | // This is from 'Writing R Extensions' section 5.10.1 3 | // BUT slowed down by using REAL() on each access which proves to be rather costly 4 | 5 | #include 6 | #include 7 | 8 | SEXP convolve7(SEXP a, SEXP b) 9 | { 10 | int i, j, na, nb, nab; 11 | SEXP ab; 12 | 13 | PROTECT(a = AS_NUMERIC(a)); 14 | PROTECT(b = AS_NUMERIC(b)); 15 | na = LENGTH(a); nb = LENGTH(b); nab = na + nb - 1; 16 | PROTECT(ab = NEW_NUMERIC(nab)); 17 | for(i = 0; i < nab; i++) REAL(ab)[i] = 0.0; 18 | for(i = 0; i < na; i++) 19 | for(j = 0; j < nb; j++) REAL(ab)[i + j] += REAL(a)[i] * REAL(b)[j]; 20 | UNPROTECT(3); 21 | return(ab); 22 | 23 | } 24 | 25 | 26 | #include "loopmacro.h" 27 | LOOPMACRO_C(convolve7) 28 | 29 | -------------------------------------------------------------------------------- /inst/examples/RcppInline/RcppSimpleExample.r: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env r 2 | 3 | 4 | suppressMessages(library(Rcpp)) 5 | suppressMessages(library(inline)) 6 | 7 | 8 | foo <- ' 9 | int i, j, na, nb, nab; 10 | double *xa, *xb, *xab; 11 | SEXP ab; 12 | 13 | PROTECT(a = AS_NUMERIC(a)); 14 | PROTECT(b = AS_NUMERIC(b)); 15 | na = LENGTH(a); nb = LENGTH(b); nab = na + nb - 1; 16 | PROTECT(ab = NEW_NUMERIC(nab)); 17 | xa = NUMERIC_POINTER(a); xb = NUMERIC_POINTER(b); 18 | xab = NUMERIC_POINTER(ab); 19 | for(i = 0; i < nab; i++) xab[i] = 0.0; 20 | for(i = 0; i < na; i++) 21 | for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j]; 22 | UNPROTECT(3); 23 | return(ab); 24 | ' 25 | 26 | funx <- cfunction(signature(a="numeric",b="numeric"), foo, Rcpp=FALSE, verbose=FALSE) 27 | funx(a=1:20, b=2:11) 28 | -------------------------------------------------------------------------------- /docker/ci/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM rocker/r2u:latest 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends \ 11 | libcurl4-openssl-dev \ 12 | libssl-dev \ 13 | r-cran-covr \ 14 | r-cran-inline \ 15 | r-cran-pkgkitten \ 16 | r-cran-tinytest \ 17 | r-cran-xml2 \ 18 | git \ 19 | && install.r rbenchmark 20 | 21 | ENV _R_CHECK_FORCE_SUGGESTS_ FALSE 22 | ENV _R_CHECK_TESTS_NLINES_ 0 23 | ENV RunAllRcppTests yes 24 | 25 | CMD ["bash"] 26 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve2_c.c: -------------------------------------------------------------------------------- 1 | 2 | /* This is from 'Writing R Extensions' section 5.10.1 */ 3 | 4 | #include 5 | #include 6 | 7 | SEXP convolve2(SEXP a, SEXP b) 8 | { 9 | int i, j, na, nb, nab; 10 | double *xa, *xb, *xab; 11 | SEXP ab; 12 | 13 | PROTECT(a = AS_NUMERIC(a)); 14 | PROTECT(b = AS_NUMERIC(b)); 15 | na = LENGTH(a); nb = LENGTH(b); nab = na + nb - 1; 16 | PROTECT(ab = NEW_NUMERIC(nab)); 17 | xa = NUMERIC_POINTER(a); xb = NUMERIC_POINTER(b); 18 | xab = NUMERIC_POINTER(ab); 19 | for(i = 0; i < nab; i++) xab[i] = 0.0; 20 | for(i = 0; i < na; i++) 21 | for(j = 0; j < nb; j++) xab[i + j] += xa[i] * xb[j]; 22 | UNPROTECT(3); 23 | return(ab); 24 | } 25 | 26 | #include "loopmacro.h" 27 | LOOPMACRO_C(convolve2) 28 | 29 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppClass/man/Rcpp_class_examples.Rd: -------------------------------------------------------------------------------- 1 | \name{Rcpp Modules Examples} 2 | \alias{Num} 3 | \alias{RcppClassWorld} 4 | \alias{bar} 5 | \alias{bla} 6 | \alias{baz} 7 | \alias{bla1} 8 | \alias{baz1} 9 | \alias{bla2} 10 | \alias{foo} 11 | \alias{vec} 12 | \alias{hello} 13 | \alias{genWorld} 14 | \alias{stdNumeric} 15 | \alias{Rcpp_Num-class} 16 | \alias{Rcpp_RcppClassWorld-class} 17 | \alias{Rcpp_vec-class} 18 | \alias{stdNumeric-class} 19 | \alias{RcppClassWorld-class} 20 | \alias{C++Object-class} 21 | \title{ 22 | Functions and Objects created by Rcpp Modules Example 23 | } 24 | \description{ 25 | These function and objects are accessible from R via the Rcpp Modules mechanism 26 | which creates them based on the declaration in the C++ file. 27 | } 28 | \seealso{ 29 | The Rcpp Modules vignette. 30 | } -------------------------------------------------------------------------------- /man/Module.Rd: -------------------------------------------------------------------------------- 1 | \name{Module} 2 | \alias{Module} 3 | \title{ 4 | Retrieves an Rcpp module 5 | } 6 | \description{ 7 | Retrieves an Rcpp module from a dynamic library, usually associated with a 8 | package. 9 | } 10 | \usage{ 11 | Module(module, PACKAGE = , where = , mustStart = ) 12 | } 13 | \arguments{ 14 | \item{module}{Name of the module, as declared in the \code{RCPP_MODULE} macro internally} 15 | \item{PACKAGE}{Passed to \code{\link{getNativeSymbolInfo}}} 16 | \item{where}{When the module is loaded, S4 classes are defined based on the 17 | internal classes. This argument is passed to \code{\link{setClass}} 18 | } 19 | \item{mustStart}{TODO} 20 | } 21 | \value{ 22 | An object of class \linkS4class{Module} collecting functions 23 | and classes declared in the module. 24 | } 25 | \keyword{programming} 26 | 27 | -------------------------------------------------------------------------------- /man/Rcpp-internal.Rd: -------------------------------------------------------------------------------- 1 | \name{Rcpp-internal} 2 | \alias{Rcpp-internal} 3 | \alias{cpp_object_initializer} 4 | \alias{cpp_object_dummy} 5 | \title{Rcpp internal functions} 6 | \description{The \pkg{Rcpp} utilizes several internal functions which 7 | need to visible within its namespace, yet are not user-facing. This 8 | page provides basic documentation for them. 9 | } 10 | \usage{ 11 | cpp_object_initializer(.self, .refClassDef, ..., .object_pointer) 12 | cpp_object_dummy(.self, .refClassDef) 13 | } 14 | \arguments{ 15 | \item{.self}{A reference to the object being modified} 16 | \item{.refClassDef}{The definition of a reference class} 17 | \item{...}{Further arguments} 18 | \item{.object_pointer}{Optional external pointer} 19 | } 20 | \keyword{programming} 21 | \keyword{interface} 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve12_cpp.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 | 3 | // This is a rewrite of the 'Writing R Extensions' section 5.10.1 example 4 | 5 | #include 6 | 7 | RcppExport SEXP convolve12cpp(SEXP a, SEXP b){ 8 | Rcpp::NumericVector xa(a), xb(b); 9 | int n_xa = xa.size(), n_xb = xb.size(); 10 | Rcpp::NumericVector xab(n_xa + n_xb - 1); 11 | 12 | typedef Rcpp::NumericVector::iterator vec_iterator ; 13 | vec_iterator ia = xa.begin(), ib = xb.begin(); 14 | vec_iterator iab = xab.begin(); 15 | for (int i = 0; i < n_xa; i++) 16 | for (int j = 0; j < n_xb; j++) 17 | iab[i + j] += ia[i] * ib[j]; 18 | 19 | return xab; 20 | } 21 | 22 | #include "loopmacro.h" 23 | LOOPMACRO_CPP(convolve12cpp) 24 | 25 | -------------------------------------------------------------------------------- /man/CppObject-class.Rd: -------------------------------------------------------------------------------- 1 | \name{C++Object-class} 2 | \Rdversion{1.1} 3 | \docType{class} 4 | \alias{C++Object-class} 5 | \alias{$,C++Object-method} 6 | \alias{$<-,C++Object-method} 7 | \alias{show,C++Object-method} 8 | 9 | \title{c++ internal objects} 10 | \description{ 11 | C++ internal objects instanciated from a class exposed in an Rcpp module 12 | } 13 | \section{Objects from the Class}{ 14 | This is a virtual class. Actual C++ classes are subclasses. 15 | } 16 | \section{Methods}{ 17 | \describe{ 18 | \item{$}{\code{signature(x = "C++Object")}: invokes a method on the object, or retrieves the value of a property } 19 | \item{$<-}{\code{signature(x = "C++Object")}: set the value of a property } 20 | \item{show}{\code{signature(object = "C++Object")}: print the object } 21 | } 22 | } 23 | \keyword{classes} 24 | -------------------------------------------------------------------------------- /man/registerPlugin.Rd: -------------------------------------------------------------------------------- 1 | \name{registerPlugin} 2 | \alias{registerPlugin} 3 | \title{ 4 | Register an inline plugin 5 | } 6 | \description{ 7 | Register an \link[inline:plugins]{inline plugin} for use with 8 | \code{\link{sourceCpp}} or \code{\link{cppFunction}}. Inline plugins are functions 9 | that return a list with additional includes, environment variables, and 10 | other compilation context. 11 | } 12 | \usage{ 13 | registerPlugin(name, plugin) 14 | } 15 | \arguments{ 16 | \item{name}{Name of the inline plugin} 17 | \item{plugin}{Inline plugin function} 18 | } 19 | \details{ 20 | Plugins can be added to \code{\link{sourceCpp}} compilations using the 21 | \code{\link[=pluginsAttribute]{Rcpp::plugins}} attribute. 22 | } 23 | \seealso{ 24 | \code{\link[=pluginsAttribute]{Rcpp::plugins}} 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/buildAndRun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -f *.o *.so 4 | 5 | # build the shared library for the C variant 6 | R CMD SHLIB convolve2_c.c 7 | R CMD SHLIB convolve7_c.c 8 | 9 | # build the shared library for the C++ variant 10 | # we have to let R know where the Rcpp header and library are 11 | export PKG_CPPFLAGS=`Rscript -e "Rcpp:::CxxFlags()"` 12 | export PKG_LIBS=`Rscript -e "Rcpp:::LdFlags()"` 13 | R CMD SHLIB convolve3_cpp.cpp 14 | R CMD SHLIB convolve4_cpp.cpp 15 | R CMD SHLIB convolve5_cpp.cpp 16 | R CMD SHLIB convolve8_cpp.cpp 17 | R CMD SHLIB convolve9_cpp.cpp 18 | R CMD SHLIB convolve10_cpp.cpp 19 | R CMD SHLIB convolve11_cpp.cpp 20 | R CMD SHLIB convolve12_cpp.cpp 21 | R CMD SHLIB convolve14_cpp.cpp 22 | 23 | # call R so that we get an interactive session 24 | Rscript exampleRCode.r 25 | 26 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve4_cpp.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 | 3 | // This is a rewrite of the 'Writing R Extensions' section 5.10.1 example 4 | 5 | #include 6 | 7 | RcppExport SEXP convolve4cpp(SEXP a, SEXP b) { 8 | Rcpp::NumericVector xa(a); 9 | Rcpp::NumericVector xb(b); 10 | int n_xa = xa.size() ; 11 | int n_xb = xb.size() ; 12 | int nab = n_xa + n_xb - 1; 13 | Rcpp::NumericVector xab(nab,0.0); 14 | 15 | double* pa = xa.begin() ; 16 | double* pb = xb.begin() ; 17 | double* pab = xab.begin() ; 18 | int i,j=0; 19 | for (i = 0; i < n_xa; i++) 20 | for (j = 0; j < n_xb; j++) 21 | pab[i + j] += pa[i] * pb[j]; 22 | 23 | return xab ; 24 | } 25 | 26 | #include "loopmacro.h" 27 | LOOPMACRO_CPP(convolve4cpp) 28 | 29 | 30 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/overhead.r: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env r 2 | 3 | set.seed(42) 4 | a <- rnorm(100) 5 | b <- rnorm(100) 6 | 7 | ## load shared libraries with wrapper code 8 | dyn.load("overhead_1.so") 9 | dyn.load("overhead_2.so") 10 | 11 | overhead_c_symbol <- getNativeSymbolInfo( "overhead_c" ) 12 | overhead_cpp_symbol <- getNativeSymbolInfo( "overhead_cpp" ) 13 | 14 | overhead_c <- function(a,b) .Call( overhead_c_symbol, a, b ) 15 | overhead_cpp <- function(a,b) .Call( overhead_cpp_symbol, a, b ) 16 | 17 | ## load benchmarkin helper function 18 | suppressMessages(library(rbenchmark)) 19 | 20 | res <- benchmark(overhead_cpp(a,b), overhead_c(a,b), 21 | columns=c("test", "replications", "elapsed", "relative", "user.self", "sys.self"), 22 | order="relative", 23 | replications=10000) 24 | print(res) 25 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/convolve13_cpp.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 | 3 | // This is a rewrite of the 'Writing R Extensions' section 5.10.1 example 4 | 5 | #include 6 | 7 | template 8 | T convolve( const T& a, const T& b ){ 9 | int na = a.size() ; int nb = b.size() ; 10 | T out(na + nb - 1); 11 | typename T::iterator iter_a(a.begin()), iter_b(b.begin()), iter_ab( out.begin() ) ; 12 | 13 | for (int i = 0; i < na; i++) 14 | for (int j = 0; j < nb; j++) 15 | iter_ab[i + j] += iter_a[i] * iter_b[j]; 16 | 17 | return out ; 18 | } 19 | 20 | 21 | RcppExport SEXP convolve13cpp(SEXP a, SEXP b){ 22 | return convolve( Rcpp::NumericVector(a), Rcpp::NumericVector(b) ) ; 23 | } 24 | 25 | #include "loopmacro.h" 26 | LOOPMACRO_CPP(convolve13cpp) 27 | 28 | -------------------------------------------------------------------------------- /.github/workflows/linuxarm.yaml: -------------------------------------------------------------------------------- 1 | # Run CI for R using https://eddelbuettel.github.io/r-ci/ 2 | 3 | name: linuxarm 4 | 5 | on: 6 | #push: 7 | #pull_request: 8 | workflow_dispatch: 9 | 10 | env: 11 | _R_CHECK_FORCE_SUGGESTS_: "false" 12 | 13 | jobs: 14 | ci: 15 | strategy: 16 | matrix: 17 | include: 18 | #- {os: ubuntu-latest} 19 | - {os: ubuntu-24.04-arm} 20 | 21 | runs-on: ${{ matrix.os }} 22 | 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v4 26 | 27 | - name: Setup 28 | uses: eddelbuettel/github-actions/r-ci@master 29 | 30 | - name: Dependencies 31 | run: ./run.sh install_deps 32 | 33 | - name: Test 34 | run: ./run.sh run_tests 35 | 36 | #- name: Coverage 37 | # if: ${{ matrix.os == 'ubuntu-latest' }} 38 | # run: ./run.sh coverage 39 | -------------------------------------------------------------------------------- /R/bib.R: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois 2 | # 3 | # This file is part of Rcpp. 4 | # 5 | # Rcpp is free software: you can redistribute it and/or modify it 6 | # under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # Rcpp is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Rcpp. If not, see . 17 | 18 | bib <- function() { 19 | sub("\\.bib$", "", system.file("bib", "Rcpp.bib", package = "Rcpp")) 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/macos.yaml: -------------------------------------------------------------------------------- 1 | # Run CI for R using https://eddelbuettel.github.io/r-ci/ 2 | 3 | name: macos 4 | 5 | on: 6 | push: 7 | pull_request: 8 | 9 | env: 10 | _R_CHECK_FORCE_SUGGESTS_: "false" 11 | 12 | jobs: 13 | ci: 14 | strategy: 15 | matrix: 16 | include: 17 | - {os: macos-latest} 18 | - {os: macos-14} 19 | #- {os: ubuntu-latest} 20 | #- {os: ubuntu-24.04-arm} 21 | 22 | runs-on: ${{ matrix.os }} 23 | 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v4 27 | 28 | - name: Setup 29 | uses: eddelbuettel/github-actions/r-ci@master 30 | 31 | - name: Dependencies 32 | run: ./run.sh install_deps 33 | 34 | - name: Test 35 | run: ./run.sh run_tests 36 | 37 | #- name: Coverage 38 | # if: ${{ matrix.os == 'ubuntu-latest' }} 39 | # run: ./run.sh coverage 40 | -------------------------------------------------------------------------------- /docker/plus/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Emacs, make this -*- mode: sh; -*- 2 | 3 | FROM rcpp/run 4 | 5 | LABEL org.label-schema.license="GPL-2.0" \ 6 | org.label-schema.vcs-url="https://github.com/RcppCore/Rcpp" \ 7 | maintainer="Dirk Eddelbuettel " 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y --no-install-recommends \ 11 | r-cran-bh \ 12 | r-cran-bit64 \ 13 | r-cran-curl \ 14 | r-cran-httr \ 15 | r-cran-knitr \ 16 | r-cran-lazyeval \ 17 | r-cran-microbenchmark \ 18 | r-cran-openssl \ 19 | r-cran-pinp \ 20 | r-cran-rcpparmadillo \ 21 | r-cran-rcppeigen \ 22 | r-cran-rcppgsl \ 23 | r-cran-rmarkdown \ 24 | r-cran-runit \ 25 | r-cran-withr 26 | 27 | CMD ["bash"] 28 | -------------------------------------------------------------------------------- /man/CppField-class.Rd: -------------------------------------------------------------------------------- 1 | \name{C++Field-class} 2 | \Rdversion{1.1} 3 | \docType{class} 4 | \alias{C++Field-class} 5 | 6 | \title{Class "C++Field"} 7 | \description{ 8 | Metadata associated with a field of a class exposed through Rcpp modules 9 | } 10 | \section{Fields}{ 11 | \describe{ 12 | \item{\code{pointer}:}{external pointer to the internal (C++) object that represents fields} 13 | \item{\code{cpp_class}:}{(demangled) name of the C++ class of the field} 14 | \item{\code{read_only}:}{Is this field read only} 15 | \item{\code{class_pointer}:}{external pointer to the class this field is from. } 16 | } 17 | } 18 | \section{Methods}{ 19 | No methods defined with class "C++Field" in the signature. 20 | } 21 | \seealso{ 22 | The \code{fields} slot of the \code{\linkS4class{C++Class}} class is a 23 | list of \code{C++Field} objects 24 | } 25 | \examples{ 26 | showClass("C++Field") 27 | } 28 | \keyword{classes} 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/Rcpp: -------------------------------------------------------------------------------- 1 | // Rcpp/Rcpp: R/C++ interface class library 2 | // 3 | // Copyright (C) 2008 - 2021 Dirk Eddelbuettel 4 | // Copyright (C) 2009 - 2021 Dirk Eddelbuettel and Romain Francois 5 | // 6 | // This file is part of Rcpp. 7 | // 8 | // Rcpp is free software: you can redistribute it and/or modify it 9 | // under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation, either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // Rcpp is distributed in the hope that it will be useful, but 14 | // WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with Rcpp. If not, see . 20 | 21 | #include 22 | -------------------------------------------------------------------------------- /vignettes/rmd/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ## This Makefile is not included in the package sources so we can use GNUmake idioms. Yay. 3 | 4 | rmdsources := $(wildcard *.Rmd) 5 | rmdvignettes := $(rmdsources:.Rmd=.pdf) 6 | 7 | %.pdf: %.Rmd 8 | Rscript -e 'rmarkdown::render("$<")' 9 | Rscript -e 'tools::compactPDF("$@", gs_quality="ebook")' 10 | cp -vax $@ .. 11 | 12 | all: ${rmdvignettes} Rcpp-jss-2011.pdf 13 | 14 | Rcpp-jss-2011.tex: Rcpp-jss-2011.Rnw 15 | Rscript -e 'Sweave("$<")' 16 | 17 | Rcpp-jss-2011.pdf: Rcpp-jss-2011.tex 18 | Rscript -e 'tools::texi2pdf("$<", texi2dvi="pdflatex")' 19 | bibtex Rcpp-jss-2011.aux 20 | Rscript -e 'tools::texi2pdf("$<", texi2dvi="pdflatex")' 21 | Rscript -e 'tools::compactPDF("$@", gs_quality="ebook")' 22 | cp -vax $@ .. 23 | 24 | clean: 25 | @rm -rf *.aux *.log *.out *.toc *.tex *.pdf Rcpp-introduction_cache Rcpp-libraries_cache pinp.cls Rcpp-jss-2011.bbl Rcpp-jss-2011.blg auto 26 | -------------------------------------------------------------------------------- /inst/examples/Attributes/Export.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | using namespace Rcpp; 5 | 6 | // [[Rcpp::export]] 7 | int fibonacci(const int x) { 8 | 9 | if (x == 0) return(0); 10 | if (x == 1) return(1); 11 | 12 | return (fibonacci(x - 1)) + fibonacci(x - 2); 13 | } 14 | 15 | 16 | // [[Rcpp::export("convolveCpp")]] 17 | NumericVector convolve(NumericVector a, NumericVector b) { 18 | 19 | int na = a.size(), nb = b.size(); 20 | int nab = na + nb - 1; 21 | NumericVector xab(nab); 22 | 23 | for (int i = 0; i < na; i++) 24 | for (int j = 0; j < nb; j++) 25 | xab[i + j] += a[i] * b[j]; 26 | 27 | return xab; 28 | } 29 | 30 | 31 | // [[Rcpp::export]] 32 | List lapplyCpp(List input, Function f) { 33 | 34 | List output(input.size()); 35 | 36 | std::transform(input.begin(), input.end(), output.begin(), f); 37 | output.names() = input.names(); 38 | 39 | return output; 40 | } 41 | -------------------------------------------------------------------------------- /man/RcppUnitTests.Rd: -------------------------------------------------------------------------------- 1 | \name{RcppUnitTests} 2 | \alias{RcppUnitTests} 3 | 4 | \title{Rcpp : unit tests results} 5 | \description{ 6 | Unit tests results for package Rcpp. 7 | 8 | Unit tests are run automatically at build time and reports are included in the 9 | \samp{doc} directory as html or text. 10 | } 11 | 12 | \seealso{ 13 | \ifelse{latex}{}{\ifelse{html}{\url{../doc/unitTests-results/Rcpp-unitTests.html}: html formatted unit test report}{\samp{../doc/unitTests-results/Rcpp-unitTests.html}: html formatted unit test report}} 14 | } 15 | 16 | \examples{ 17 | # unit tests are in the unitTests directory of the package 18 | list.files( system.file("unitTests", package = "Rcpp" ), 19 | pattern = "^runit", full = TRUE ) 20 | 21 | # trigger the unit tests preparation, follow printed instructions 22 | # on how to run them 23 | \dontrun{ 24 | source( system.file("unitTests", "runTests.R", package = "Rcpp" ) ) 25 | } 26 | } 27 | 28 | \keyword{programming} 29 | -------------------------------------------------------------------------------- /man/Module-class.Rd: -------------------------------------------------------------------------------- 1 | \name{Module-class} 2 | \Rdversion{1.1} 3 | \docType{class} 4 | \alias{Module-class} 5 | \alias{$,Module-method} 6 | \alias{prompt,Module-method} 7 | \alias{show,Module-method} 8 | \alias{initialize,Module-method} 9 | 10 | \title{Rcpp modules} 11 | \description{ 12 | Collection of internal c++ functions and classes exposed to R 13 | } 14 | \section{Objects from the Class}{ 15 | modules are created by the \code{link{Module}} function 16 | } 17 | \section{Methods}{ 18 | \describe{ 19 | \item{$}{\code{signature(x = "Module")}: extract a function or a class from the module. } 20 | \item{prompt}{\code{signature(object = "Module")}: generates skeleton of a documentation for a Module. } 21 | \item{show}{\code{signature(object = "Module")}: summary information about the module. } 22 | \item{initialize}{\code{signature(.Object = "Module")}: ... } 23 | } 24 | } 25 | \seealso{ 26 | The \code{\link{Module}} function 27 | } 28 | \keyword{classes} 29 | -------------------------------------------------------------------------------- /inst/examples/Attributes/Depends.cpp: -------------------------------------------------------------------------------- 1 | 2 | // [[Rcpp::depends(RcppArmadillo)]] 3 | 4 | #include 5 | 6 | using namespace Rcpp; 7 | 8 | // [[Rcpp::export]] 9 | List fastLm(NumericVector yr, NumericMatrix Xr) { 10 | 11 | int n = Xr.nrow(), k = Xr.ncol(); 12 | 13 | arma::mat X(Xr.begin(), n, k, false); // reuses memory and avoids extra copy 14 | arma::colvec y(yr.begin(), yr.size(), false); 15 | 16 | arma::colvec coef = arma::solve(X, y); // fit model y ~ X 17 | arma::colvec resid = y - X*coef; // residuals 18 | 19 | double sig2 = arma::as_scalar( arma::trans(resid)*resid/(n-k) ); 20 | // std.error of estimate 21 | arma::colvec stderrest = arma::sqrt( 22 | sig2 * arma::diagvec( arma::inv(arma::trans(X)*X)) ); 23 | 24 | return List::create(Named("coefficients") = coef, 25 | Named("stderr") = stderrest 26 | ); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /inst/examples/Misc/newFib.r: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env r 2 | 3 | ## New and shorter version of Fibonacci example using Rcpp 0.9.16 or later features 4 | ## The the sibbling file 'fibonacci.r' for context 5 | 6 | require(Rcpp) # no longer need inline 7 | 8 | ## R version 9 | fibR <- function(seq) { 10 | if (seq < 2) return(seq) 11 | return (fibR(seq - 1) + fibR(seq - 2)) 12 | } 13 | 14 | ## C++ code 15 | cpptxt <- ' 16 | int fibonacci(const int x) { 17 | if (x < 2) return(x); 18 | return (fibonacci(x - 1)) + fibonacci(x - 2); 19 | }' 20 | 21 | ## C++ version 22 | fibCpp <- cppFunction(cpptxt) # compiles, load, links, ... 23 | 24 | ## load rbenchmark to compare 25 | library(rbenchmark) 26 | 27 | N <- 35 ## same parameter as original post 28 | res <- benchmark(fibR(N), fibCpp(N), 29 | columns=c("test", "replications", "elapsed", "relative"), 30 | order="relative", replications=1) 31 | print(res) ## show result 32 | 33 | -------------------------------------------------------------------------------- /inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1.dsc: -------------------------------------------------------------------------------- 1 | Format: 1.0 2 | Source: r-cran-testrcpppackage 3 | Binary: r-cran-testrcpppackage 4 | Architecture: any 5 | Version: 0.1.0-1 6 | Maintainer: Dirk Eddelbuettel 7 | Standards-Version: 3.9.6 8 | Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.1.1), cdbs 9 | Package-List: 10 | r-cran-testrcpppackage deb gnu-r optional 11 | Checksums-Sha1: 12 | 4cfa8b64d4f4adc2e991ac1faae18263eb78fe07 2171 r-cran-testrcpppackage_0.1.0.orig.tar.gz 13 | 234e00a49064072d509cb5e6cc8e7d0bc3608245 572 r-cran-testrcpppackage_0.1.0-1.diff.gz 14 | Checksums-Sha256: 15 | 95575315827f284f5c6aacbafeba0a9609e50e312a09f7a2ff94faade83ef876 2171 r-cran-testrcpppackage_0.1.0.orig.tar.gz 16 | 540cc246865c5361587fa4b9cdfa604a7a2be630825bcc0b0d62cfbd7f648915 572 r-cran-testrcpppackage_0.1.0-1.diff.gz 17 | Files: 18 | e424c851ac8f4fa40185cf4399737c7d 2171 r-cran-testrcpppackage_0.1.0.orig.tar.gz 19 | 54073056db0ba60cf0b1707c4b6db85c 572 r-cran-testrcpppackage_0.1.0-1.diff.gz 20 | -------------------------------------------------------------------------------- /man/CppOverloadedMethods-class.Rd: -------------------------------------------------------------------------------- 1 | \name{C++OverloadedMethods-class} 2 | \Rdversion{1.1} 3 | \docType{class} 4 | \alias{C++OverloadedMethods-class} 5 | 6 | \title{Class "C++OverloadedMethods"} 7 | \description{ 8 | Set of C++ methods 9 | } 10 | \section{Extends}{ 11 | Class \code{"\linkS4class{envRefClass}"}, directly. 12 | Class \code{"\linkS4class{.environment}"}, by class "envRefClass", distance 2. 13 | Class \code{"\linkS4class{refClass}"}, by class "envRefClass", distance 2. 14 | Class \code{"\linkS4class{environment}"}, by class "envRefClass", distance 3, with explicit coerce. 15 | Class \code{"\linkS4class{refObject}"}, by class "envRefClass", distance 3. 16 | } 17 | \keyword{classes} 18 | \section{Fields}{ 19 | \describe{ 20 | \item{\code{pointer}:}{Object of class \code{externalptr} pointer to the internal structure that represents the set of methods } 21 | \item{\code{class_pointer}:}{Object of class \code{externalptr} pointer to the internal structure that models the related class } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /inst/tinytest/test_coerce.R: -------------------------------------------------------------------------------- 1 | 2 | ## Copyright (C) 2022 Dirk Eddelbuettel and Kevin Ushey 3 | ## 4 | ## This file is part of Rcpp. 5 | ## 6 | ## Rcpp is free software: you can redistribute it and/or modify it 7 | ## under the terms of the GNU General Public License as published by 8 | ## the Free Software Foundation, either version 2 of the License, or 9 | ## (at your option) any later version. 10 | ## 11 | ## Rcpp is distributed in the hope that it will be useful, but 12 | ## WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public License 17 | ## along with Rcpp. If not, see . 18 | 19 | if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.") 20 | 21 | Rcpp::sourceCpp("cpp/coerce.cpp") 22 | 23 | expect_equal(coerce_raw_to_string(0xaa), "aa") 24 | -------------------------------------------------------------------------------- /inst/include/Rcpp/protection/protection.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Romain Francois 2 | // 3 | // This file is part of Rcpp. 4 | // 5 | // Rcpp is free software: you can redistribute it and/or modify it 6 | // under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Rcpp is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with Rcpp. If not, see . 17 | 18 | #ifndef Rcpp_protection_protection_H 19 | #define Rcpp_protection_protection_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /inst/examples/performance/performance.R: -------------------------------------------------------------------------------- 1 | 2 | require( inline ) 3 | require( Rcpp ) 4 | 5 | expressions <- list( 6 | times = "x * y" , 7 | plus = "x + y" 8 | # , 9 | # minus = "x - y", 10 | # divides = "x / y", 11 | # exp_ = "exp( x )" 12 | ) 13 | 14 | signatures <- lapply( expressions, function(.) signature( x_ = "numeric", y_ = "numeric", n_ = "integer" ) ) 15 | bodies <- lapply( expressions, function(.){ 16 | sprintf( ' 17 | int n = as( n_ ) ; 18 | NumericVector x(x_), y(y_), z(x.size()) ; 19 | for( int i=0; i 20 | } 21 | \references{ 22 | This optional section can contain literature or other references for 23 | background information. 24 | } 25 | \keyword{ package } 26 | \seealso{ 27 | Optional links to other man pages 28 | } 29 | \examples{ 30 | \dontrun{ 31 | ## Optional simple examples of the most important functions 32 | ## These can be in \dontrun{} and \donttest{} blocks. 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /inst/tinytest/cpp/wstring.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace Rcpp ; 3 | 4 | // [[Rcpp::export]] 5 | CharacterVector CharacterVector_wstring( ){ 6 | CharacterVector res(2) ; 7 | res[0] = L"foo" ; 8 | res[0] += L"bar" ; 9 | 10 | res[1] = std::wstring( L"foo" ) ; 11 | res[1] += std::wstring( L"bar" ) ; 12 | 13 | return res ; 14 | } 15 | 16 | // [[Rcpp::export]] 17 | std::wstring wstring_return(){ 18 | return L"foo" ; 19 | } 20 | 21 | // [[Rcpp::export]] 22 | String wstring_param(std::wstring s1, std::wstring s2){ 23 | String s = s1 ; 24 | s += s2 ; 25 | return s ; 26 | } 27 | 28 | // [[Rcpp::export]] 29 | std::vector wrap_vector_wstring(){ 30 | std::vector res(2 ); 31 | res[0] = L"foo" ; 32 | res[1] = L"bar" ; 33 | return res; 34 | } 35 | 36 | // [[Rcpp::export]] 37 | std::vector as_vector_wstring( std::vector x){ 38 | for( size_t i=0; i 2 | #include 3 | #include // for NULL 4 | #include 5 | 6 | /* FIXME: 7 | Check these declarations against the C/Fortran source code. 8 | */ 9 | 10 | /* .Call calls */ 11 | extern SEXP rcpp_hello_world_cpp(void); 12 | extern SEXP _rcpp_module_boot_NumEx(void); 13 | extern SEXP _rcpp_module_boot_RcppClassModule(void); 14 | extern SEXP _rcpp_module_boot_stdVector(void); 15 | 16 | static const R_CallMethodDef CallEntries[] = { 17 | {"rcpp_hello_world_cpp", (DL_FUNC) &rcpp_hello_world_cpp, 0}, 18 | {"_rcpp_module_boot_NumEx", (DL_FUNC) &_rcpp_module_boot_NumEx, 0}, 19 | {"_rcpp_module_boot_RcppClassModule", (DL_FUNC) &_rcpp_module_boot_RcppClassModule, 0}, 20 | {"_rcpp_module_boot_stdVector", (DL_FUNC) &_rcpp_module_boot_stdVector, 0}, 21 | {NULL, NULL, 0} 22 | }; 23 | 24 | void R_init_testRcppModule(DllInfo *dll) { 25 | R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); 26 | R_useDynamicSymbols(dll, FALSE); 27 | } 28 | -------------------------------------------------------------------------------- /.github/workflows/stale.yaml: -------------------------------------------------------------------------------- 1 | # Mark stale issues and pull requests 2 | # cf https://github.com/actions/stale 3 | 4 | name: stale 5 | 6 | on: 7 | schedule: 8 | - cron: "11 1 * * 6" 9 | 10 | jobs: 11 | stale: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/stale@v8 15 | with: 16 | repo-token: ${{ secrets.GITHUB_TOKEN }} 17 | stale-issue-label: 'no-issue-activity' 18 | stale-pr-label: 'no-pr-activity' 19 | days-before-stale: 365 20 | days-before-close: 31 21 | stale-issue-message: > 22 | This issue is stale (365 days without activity) and will be closed 23 | in 31 days unless new activity is seen. Please feel free to re-open 24 | it is still a concern, possibly with additional data. 25 | stale-pr-message: > 26 | This pull request is is stale (365 days without activity) and will 27 | be closed in 31 days unless new activity is seen. Please feel free 28 | to open a new issue to discuss a fresh approach. 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/Light: -------------------------------------------------------------------------------- 1 | // Rcpp/Light: R/C++ interface class library -- without Rcpp Modules 2 | // 3 | // Copyright (C) 2008 - 2021 Dirk Eddelbuettel 4 | // Copyright (C) 2009 - 2021 Dirk Eddelbuettel and Romain Francois 5 | // 6 | // This file is part of Rcpp. 7 | // 8 | // Rcpp is free software: you can redistribute it and/or modify it 9 | // under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation, either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // Rcpp is distributed in the hope that it will be useful, but 14 | // WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with Rcpp. If not, see . 20 | 21 | // no Modules 22 | #define RCPP_NO_MODULES 23 | 24 | // include Rcpp as usual 25 | #include 26 | -------------------------------------------------------------------------------- /inst/include/Rcpp/macros/cat.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef RCPP_PREPROCESSOR_CAT_HPP 15 | # define RCPP_PREPROCESSOR_CAT_HPP 16 | # 17 | # /* RCPP_PP_CAT */ 18 | # 19 | # if ~RCPP_PP_CONFIG_FLAGS() & RCPP_PP_CONFIG_MWCC() 20 | # define RCPP_PP_CAT(a, b) RCPP_PP_CAT_I(a, b) 21 | # else 22 | # define RCPP_PP_CAT(a, b) RCPP_PP_CAT_OO((a, b)) 23 | # define RCPP_PP_CAT_OO(par) RCPP_PP_CAT_I ## par 24 | # endif 25 | # 26 | # if ~RCPP_PP_CONFIG_FLAGS() & RCPP_PP_CONFIG_MSVC() 27 | # define RCPP_PP_CAT_I(a, b) a ## b 28 | # else 29 | # define RCPP_PP_CAT_I(a, b) RCPP_PP_CAT_II(a ## b) 30 | # define RCPP_PP_CAT_II(res) res 31 | # endif 32 | # 33 | # endif 34 | -------------------------------------------------------------------------------- /inst/examples/functionCallback/README: -------------------------------------------------------------------------------- 1 | 2 | A much simpler version of the example is provided in the file newApiExample.r. 3 | With littler installed, it can be run 'as is' as a shell script; else it can 4 | be sourced into R. 5 | 6 | -- Dirk Eddelbuettel and Romain Francois, 06 Feb 2010 7 | 8 | 9 | This directory provides a simple example of how an R function 10 | can be passed back and forth between R and C++. 11 | 12 | We define the function at the R level, pass it to C++ using the Rcpp 13 | interface and have C++ call it. This works by subclassing the C++ class 14 | RcppFunction (from Rcpp) and adding a new member function transformVector() 15 | which is vector-valued. We then instantiate this new class in the C++ 16 | function called from R -- and by calling the transformVector() function from 17 | C++ we get R to operate on the supplied vector. 18 | 19 | In this demo, we simply exponeniate the data vector but also plot it as a 20 | side effect -- effectively giving us R plotting from a C++ function. 21 | 22 | -- Dirk Eddelbuettel, 29 Sep 2009 23 | -------------------------------------------------------------------------------- /inst/tinytest/testRcppModule/src/init.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include // for NULL 4 | #include 5 | 6 | /* FIXME: 7 | Check these declarations against the C/Fortran source code. 8 | */ 9 | 10 | /* .Call calls */ 11 | extern SEXP rcpp_hello_world_cpp(); 12 | extern SEXP _rcpp_module_boot_RcppModuleNumEx(); 13 | extern SEXP _rcpp_module_boot_RcppModuleWorld(); 14 | extern SEXP _rcpp_module_boot_stdVector(); 15 | 16 | static const R_CallMethodDef CallEntries[] = { 17 | {"rcpp_hello_world_cpp", (DL_FUNC) &rcpp_hello_world_cpp, 0}, 18 | {"_rcpp_module_boot_RcppModuleNumEx", (DL_FUNC) &_rcpp_module_boot_RcppModuleNumEx, 0}, 19 | {"_rcpp_module_boot_RcppModuleWorld", (DL_FUNC) &_rcpp_module_boot_RcppModuleWorld, 0}, 20 | {"_rcpp_module_boot_stdVector", (DL_FUNC) &_rcpp_module_boot_stdVector, 0}, 21 | {NULL, NULL, 0} 22 | }; 23 | 24 | void R_init_testRcppModule(DllInfo *dll) { 25 | R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); 26 | R_useDynamicSymbols(dll, FALSE); 27 | } 28 | -------------------------------------------------------------------------------- /inst/include/Rcpp/proxy/GenericProxy.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Romain Francois 2 | // 3 | // This file is part of Rcpp. 4 | // 5 | // Rcpp is free software: you can redistribute it and/or modify it 6 | // under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Rcpp is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with Rcpp. If not, see . 17 | 18 | #ifndef Rcpp_proxy_GenericProxy_h 19 | #define Rcpp_proxy_GenericProxy_h 20 | 21 | namespace Rcpp{ 22 | 23 | template 24 | struct GenericProxy { 25 | inline SEXP get() const { 26 | return static_cast(*this) ; 27 | } 28 | } ; 29 | 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/f.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // f.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__f_h 23 | #define Rcpp__stats__f_h 24 | 25 | RCPP_DPQ_2(f,::Rf_df,::Rf_pf,::Rf_qf) 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/t.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // t.h: Rcpp R/C++ interface class library -- t distribution 4 | // 5 | // Copyright (C) 2010 - 2016 Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__t_h 23 | #define Rcpp__stats__t_h 24 | 25 | RCPP_DPQ_1(t, ::Rf_dt, ::Rf_pt, ::Rf_qt) 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /inst/tinytest/cpp/rcppversion.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // [[Rcpp::export]] 4 | Rcpp::List checkVersion(Rcpp::IntegerVector v) { 5 | 6 | // incoming, we expect v to have been made by 7 | // as.integer(unlist(strsplit(as.character(packageVersion("Rcpp")), "\\."))) 8 | // yielding eg 9 | // c(1L, 0L, 3L, 1L) 10 | 11 | // ensure that length is four, after possibly appending 0 12 | if (v.size() == 3) v.push_back(0); 13 | if (v.size() == 4) v.push_back(0); 14 | if (v.size() > 5) Rcpp::stop("Expect vector with up to five elements."); 15 | 16 | return Rcpp::List::create(Rcpp::Named("def_ver") = RCPP_VERSION, 17 | Rcpp::Named("def_str") = RCPP_VERSION_STRING, 18 | Rcpp::Named("cur_ver") = Rcpp_Version(v[0], v[1], v[2]), 19 | Rcpp::Named("def_dev_ver") = RCPP_DEV_VERSION, 20 | Rcpp::Named("def_dev_str") = RCPP_DEV_VERSION_STRING, 21 | Rcpp::Named("cur_dev_ver") = RcppDevVersion(v[0], v[1], v[2], v[3])); 22 | } 23 | -------------------------------------------------------------------------------- /inst/include/Rcpp/Lighter: -------------------------------------------------------------------------------- 1 | // Rcpp/Lighter: R/C++ interface class library -- without Rcpp Modules + RTTI 2 | // 3 | // Copyright (C) 2008 - 2021 Dirk Eddelbuettel 4 | // Copyright (C) 2009 - 2021 Dirk Eddelbuettel and Romain Francois 5 | // 6 | // This file is part of Rcpp. 7 | // 8 | // Rcpp is free software: you can redistribute it and/or modify it 9 | // under the terms of the GNU General Public License as published by 10 | // the Free Software Foundation, either version 2 of the License, or 11 | // (at your option) any later version. 12 | // 13 | // Rcpp is distributed in the hope that it will be useful, but 14 | // WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with Rcpp. If not, see . 20 | 21 | // no RTTI (actually implies no Modules) -- solid gain 22 | #define RCPP_NO_RTTI 23 | 24 | // include Rcpp/Light which includes Rcpp 25 | #include 26 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/pois.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // pois.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__pois_h 23 | #define Rcpp__stats__pois_h 24 | 25 | RCPP_DPQ_1(pois,::Rf_dpois,::Rf_ppois,::Rf_qpois) 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /inst/examples/OpenMP/GNUmakefile: -------------------------------------------------------------------------------- 1 | 2 | ## comment this out if you need a different version of R, 3 | ## and set set R_HOME accordingly as an environment variable 4 | R_HOME := $(shell R RHOME) 5 | 6 | ## include headers and libraries for R 7 | RCPPFLAGS := $(shell $(R_HOME)/bin/R CMD config --cppflags) 8 | RLDFLAGS := $(shell $(R_HOME)/bin/R CMD config --ldflags) 9 | 10 | ## include headers and libraries for Rcpp interface classes 11 | RCPPINCL := $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave) 12 | RCPPLIBS := $(shell echo 'Rcpp:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave) 13 | 14 | ## OpenMP 15 | OPENMPFLAGS := -fopenmp 16 | 17 | c_sources := $(wildcard *.c) 18 | c_sharedlibs := $(patsubst %.c,%.o,$(c_sources)) 19 | 20 | cpp_sources := $(wildcard *.cpp) 21 | cpp_sharedlibs := $(patsubst %.cpp,%.o,$(cpp_sources)) 22 | 23 | all : $(c_sharedlibs) $(cpp_sharedlibs) 24 | 25 | %.o : %.c 26 | R CMD SHLIB $< 27 | 28 | %.o : %.cpp 29 | PKG_CPPFLAGS="$(RCPPFLAGS) $(RCPPINCL) $(OPENMPFLAGS)" PKG_LIBS="$(RLDFLAGS) $(RCPPLIBS) $(OPENMPFLAGS)" R CMD SHLIB $< 30 | 31 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/nf.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // nf.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__nf_h 23 | #define Rcpp__stats__nf_h 24 | 25 | RCPP_DPQ_3(nf,::Rf_dnf,::Rf_pnf,::Rf_qnf) 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/nt.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // nt.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__nt_h 23 | #define Rcpp__stats__nt_h 24 | 25 | RCPP_DPQ_2(nt,::Rf_dnt,::Rf_pnt,::Rf_qnt) 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/binom.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // binom.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__binom_h 23 | #define Rcpp__stats__binom_h 24 | 25 | RCPP_DPQ_2(binom,::Rf_dbinom,::Rf_pbinom,::Rf_qbinom) 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /inst/examples/ConvolveBenchmarks/GNUmakefile: -------------------------------------------------------------------------------- 1 | 2 | ## comment this out if you need a different version of R, 3 | ## and set set R_HOME accordingly as an environment variable 4 | R_HOME := $(shell R RHOME) 5 | 6 | ## include headers and libraries for R 7 | RCPPFLAGS := $(shell $(R_HOME)/bin/R CMD config --cppflags) 8 | RLDFLAGS := $(shell $(R_HOME)/bin/R CMD config --ldflags) 9 | 10 | ## include headers and libraries for Rcpp interface classes 11 | RCPPINCL := $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave) 12 | RCPPLIBS := $(shell echo 'Rcpp:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave) 13 | 14 | c_sources := $(wildcard *.c) 15 | c_sharedlibs := $(patsubst %.c,%.o,$(c_sources)) 16 | 17 | cpp_sources := $(wildcard *.cpp) 18 | cpp_sharedlibs := $(patsubst %.cpp,%.o,$(cpp_sources)) 19 | 20 | all : $(c_sharedlibs) $(cpp_sharedlibs) 21 | 22 | %.o : %.c 23 | R CMD SHLIB $< 24 | 25 | %.o : %.cpp 26 | PKG_CPPFLAGS="$(RCPPFLAGS) $(RCPPINCL)" PKG_LIBS="$(RLDFLAGS) $(RCPPLIBS)" R CMD SHLIB $< 27 | 28 | run : $(c_sharedlibs) $(cpp_sharedlibs) 29 | Rscript exampleRCode.r 30 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/beta.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // beta.h: Rcpp R/C++ interface class library -- beta distribution 4 | // 5 | // Copyright (C) 2010 - 2016 Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__beta_h 23 | #define Rcpp__stats__beta_h 24 | 25 | RCPP_DPQ_2(beta,::Rf_dbeta,::Rf_pbeta,::Rf_qbeta) 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /inst/include/Rcpp/api/meat/as.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Romain Francois 2 | // 3 | // This file is part of Rcpp. 4 | // 5 | // Rcpp is free software: you can redistribute it and/or modify it 6 | // under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Rcpp is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with Rcpp. If not, see . 17 | 18 | #ifndef Rcpp_api_meat_as_h 19 | #define Rcpp_api_meat_as_h 20 | 21 | namespace Rcpp{ 22 | namespace internal{ 23 | 24 | inline void* as_module_object_internal(SEXP obj){ 25 | Environment env(obj) ; 26 | SEXP xp = env.get(".pointer") ; 27 | return R_ExternalPtrAddr(xp ); 28 | } 29 | 30 | } 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/geom.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // geom.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__geom_h 23 | #define Rcpp__stats__geom_h 24 | 25 | RCPP_DPQ_1(geom, ::Rf_dgeom, ::Rf_pgeom, ::Rf_qgeom ) 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/api/meat/Dimension.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Romain Francois 2 | // 3 | // This file is part of Rcpp. 4 | // 5 | // Rcpp is free software: you can redistribute it and/or modify it 6 | // under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Rcpp is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with Rcpp. If not, see . 17 | 18 | #ifndef Rcpp_api_meat_Dimension_h 19 | #define Rcpp_api_meat_Dimension_h 20 | 21 | namespace Rcpp{ 22 | 23 | inline Dimension::Dimension(SEXP dims_) : dims( as< std::vector >(dims_) ){} 24 | 25 | inline Dimension::operator SEXP() const { 26 | return wrap( dims.begin(), dims.end() ) ; 27 | } 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/chisq.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // chisq.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__chisq_h 23 | #define Rcpp__stats__chisq_h 24 | 25 | RCPP_DPQ_1(chisq,::Rf_dchisq,::Rf_pchisq,::Rf_qchisq) 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/hyper.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // hyper.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__hyper_h 23 | #define Rcpp__stats__hyper_h 24 | 25 | RCPP_DPQ_3(hyper,::Rf_dhyper,::Rf_phyper,::Rf_qhyper) 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/stats/nbeta.h: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 2 | // 3 | // nbeta.h: Rcpp R/C++ interface class library -- 4 | // 5 | // Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois 6 | // 7 | // This file is part of Rcpp. 8 | // 9 | // Rcpp is free software: you can redistribute it and/or modify it 10 | // under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation, either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // Rcpp is distributed in the hope that it will be useful, but 15 | // WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with Rcpp. If not, see . 21 | 22 | #ifndef Rcpp__stats__nbeta_h 23 | #define Rcpp__stats__nbeta_h 24 | 25 | RCPP_DPQ_3(nbeta,::Rf_dnbeta,::Rf_pnbeta,::Rf_qnbeta) 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /inst/include/Rcpp/api/meat/DataFrame.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Romain Francois 2 | // 3 | // This file is part of Rcpp. 4 | // 5 | // Rcpp is free software: you can redistribute it and/or modify it 6 | // under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Rcpp is distributed in the hope that it will be useful, but 11 | // WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with Rcpp. If not, see . 17 | 18 | #ifndef Rcpp_api_meat_DataFrame_h 19 | #define Rcpp_api_meat_DataFrame_h 20 | 21 | namespace Rcpp{ 22 | 23 | template