git clone https://bitbucket.org/djhshih/dppmix
git submodule update --init
library(devtools)
document()
install()
The package is organized into two main layers:
R/: user-facing R API, model orchestration, and thin wrappers around compiled codesrc/: performance-critical C++ implementations exposed through RcppMain files in R/:
R/dppmix_mcmc_mvnorm.R: top-level MCMC fitting function and MCMC update logic for the multivariate normal DPP mixture modelR/dppmix_em_mvnorm.R: EM-based fitting logic and objective/gradient orchestrationR/dppmix_em_mvnorm_original.R: original pure-R implementations retained for reference and equivalence testingR/dppmix_em_mvnorm_cpp.R: thin R wrappers for compiled EM/covariance helpersR/estimate.R, R/simulate.R, R/math.R: estimation helpers, simulation helpers, and shared math utilitiesThere is also a submodule-like shared core under R/dppcore/, currently used for reusable covariance-related code.
Main files in src/:
src/covariance.cpp: compiled covariance-kernel helperssrc/ldet.cpp: compiled log-determinant helpersrc/dppmix_em_mvnorm.cpp: compiled EM update/objective/gradient helpersThe compiled interface follows the naming convention already used by the EM code:
_original
_cpp
_cpp_impl
Example:
dppmix_em_mvnorm_update_gamma_original in Rdppmix_em_mvnorm_update_gamma_cpp in Rdppmix_em_mvnorm_update_gamma_cpp_impl in C++Rcpp bindings are generated into:
R/RcppExports.Rsrc/RcppExports.cppThe package registers native routines through NAMESPACE with useDynLib(dppmix, .registration=TRUE).
src/
R/dppmix_mcmc_mvnorm.R: public API and orchestrationR/dppmix_mcmc_mvnorm_original.R: original R helper implementations retained for reference and regression testingR/dppmix_mcmc_mvnorm_cpp.R: thin wrappers around compiled MCMC helperssrc/dppmix_mcmc_mvnorm.cpp: compiled MCMC implementationsCompiled MCMC helpers currently cover:
update_zupdate_Sigmacompute_Skllikelihoodmu_is_validupdate_lambdaupdate_musplit_movecombine_moveupdate_KTests in tests/testthat/test-mcmc-cpp-equivalence.R exercise deterministic equivalence, stochastic-kernel invariants, RJMCMC move validity, and short smoke-style regression checks.