How lenarddome/psp works
Project type and purpose
• This is an R package (“psp”) that implements Parameter Space Partitioning MCMC for global model evaluation.
• It exposes a set of user-facing R functions (in R/*.R), backed by performance-critical routines in C++ (in src/*.cpp via Rcpp).
• The package includes manual documentation (man/*.Rd), vignettes/docs (docs/), and unit tests (tests/testthat).
File structure
• Top level
• DESCRIPTION, NAMESPACE, LICENSE: package metadata and exports
• README.md: overview, install instructions, philosophy
• .github/workflows/main.yml: CI pipeline on push/PR
• R/ directory
• RcppExports.R: glue code between R and C++
• Other .R files: R-only orchestration functions (e.g., psp_global.R)
• src/ directory
• RcppExports.cpp, pspGlobal.cpp: core algorithm implemented in C++
• man/ directory
• .Rd files for each exported function
• docs/ directory
• CHANGELOG.md, MASTERPLAN.md, logo, and site assets
• tests/testthat/
• test_psp_R.R, test_psp_cpp.R: unit tests for R and C++ paths
README for additional insights
• Confirms R + C++ hybrid architecture via Rcpp
• Mentions influences (Open Models Initiative, DEoptim) but no separate microservices
• Uses Google style guides for R and C++
a. Main components
1) User / Client (R console, scripts)
2) R API Layer (R/*.R)
3) Rcpp glue (RcppExports.R / .cpp)
4) C++ Core Engine (src/*.cpp)
5) Documentation subsystem (man/, docs/)
6) Test suite (tests/testthat)
7) CI/CD pipeline (GitHub Actions)
8) External dependencies (Rcpp, stats, CRAN ecosystem)
b. Relationships & data flow
• User invokes exported R functions → R API Layer
• R API calls RcppExports stubs → native C++ Core Engine
• C++ returns results → R data structures → user
• Test suite calls R API & C++ routines to validate outputs
• CI pipeline triggers build → run tests → R-CMD-CHECK → report status
• Documentation tools ingest R code (.Rd) and markdown (docs/) to build site/man pages
c. Architectural patterns & design principles
• Layered design: “Front” R interface separated from “back” C++ engine
• Rcpp bridging pattern for cross-language calls
• Clear separation of concerns: code vs. docs vs. tests vs. CI
• Conventions: manual Rd docs (no roxygen), Google style guides
d. Key technologies
• R (package infrastructure: DESCRIPTION, NAMESPACE)
• Rcpp (bindings between R and C++)
• C++ (performance-critical algorithms)
• testthat (unit testing)
• GitHub Actions (CI/CD)
• CRAN for distribution
Elements
• Blue: User-visible interface
• Green: Native code core
• Orange: Testing
• Purple: Documentation
• Grey: CI / infrastructure