Repository navigation
refactor: production-grade code quality pass — dedup, vectorize, C++17, RAII, safety #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
5cb9fd5
refactor: remove unnecessary condition for Z_buffer size in glm_c fun…
zankrut20 09d2274
refactor: optimize glm_c function for parallel processing with OpenMP
zankrut20 7a1d997
refactor: improve parameter passing and optimize loop constructs in g…
zankrut20 a73969b
refactor: remove unnecessary Z_buffer resizing in mlm_c function
zankrut20 37812b1
refactor: replace dynamic buffer allocation with std::vector in read_…
zankrut20 07bf996
refactor: optimize conjugate_gradient function by using noalias for p…
zankrut20 0c657e6
refactor: optimize parallel processing in impute_marker and hasNA fun…
zankrut20 c738d7c
refactor: change step parameter type from size_t to int in kin_cal fu…
zankrut20 4b7b154
refactor: remove unnecessary declaration of omp_setup function in mvp…
zankrut20 3c49f01
refactor: fix header guard definition and clean up commented code in …
zankrut20 0906ce1
refactor: replace assignment operators with the preferred syntax in M…
zankrut20 af4a1d2
refactor: update assignment syntax and clean up commented code in MVP…
zankrut20 0d758fd
refactor: add new EMMA delta function and improve NaN handling in MVP…
zankrut20 c149e92
refactor: remove commented debug print statements and optimize log-li…
zankrut20 7ac3432
refactor: optimize log-likelihood calculation and vectorize sigma com…
zankrut20 57ddb0a
refactor: streamline matrix operations in MVP.GLM function
zankrut20 a4b583e
refactor: declare CXX_STD = CXX17 explicitly in Makevars and Makevars…
zankrut20 1d4d2d2
refactor: unify duplicated FaSTLMM implementation into .fastlmm_core
zankrut20 0d584fa
refactor: vectorize FaSTLMM beta and LL accumulation loops in .fastlm…
zankrut20 edff97d
refactor: extract fill_geno_buffer template to eliminate 8-branch Big…
zankrut20 c0fb39b
refactor: remove gc() from hot paths and unjustified call sites
zankrut20 b332d4b
refactor: add .safe_solve() helper and replace try/solve/inherits pat…
zankrut20 76b2925
refactor: rename internal FarmCPU helpers to .farmcpu_* dot-prefix co…
zankrut20 c02bd7d
refactor: add input validation and replace magic number in MVP.BRENT.…
zankrut20 9673c0c
refactor: remove dead LogRL_dev1 and fix double-subtraction in Standa…
zankrut20 19149f0
refactor: replace raw FILE* with RAII std::ifstream/ofstream in bfile…
zankrut20 5cbafc6
perf: eliminate per-token heap allocations in VCF/HAPMAP inner-loop p…
zankrut20 24ae95f
refactor: add DISPATCH_MATRIX_TYPE macro and apply to five bigmatrix …
zankrut20 986214c
chore: remove dead type2 progress bar block and add refactor CHANGELO…
zankrut20 3f615bd
docs: add Sprint 0.1 regression tests, Sprint 1.1 constants, fix EMMA…
zankrut20 7c806d5
fix: wrap print_info example in \dontrun{} to fix R CMD check ERROR
zankrut20 f7867fc
docs: regenerate man/print_info.Rd via devtools::document()
zankrut20 0d5e52b
fix: remove @examples from print_info to fix R CMD check ERROR
zankrut20 fac897e
fix: remove stale @param and examples from print_info to clear R CMD …
zankrut20 487c911
fix: replace ##__VA_ARGS__ with __VA_ARGS__ in DISPATCH_MATRIX_TYPE m…
zankrut20 5927c67
fix: address review feedback — typo, docs, dead constant, NA note
hyacz b1bee8e
fix: address review feedback — string_view guard and .safe_solve migr…
hyacz f3db64d
test: replace .rds fixture approach with hardcoded per-SNP values
zankrut20 084eb0e
fix: wire .EMMA_* constants into MVP.EMMA.Vg.Ve body
zankrut20 de3041c
docs: list all four method options in .farmcpu_bin @param
zankrut20 668edbe
docs: fix strwrap typo in R source and regenerate affected Rd files
zankrut20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,3 +46,6 @@ vignettes/*.pdf | |
| *.knit.md | ||
| .Rproj.user | ||
| packages | ||
|
|
||
| # R Files for comparisions | ||
| compare_perf.R | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Package-level constants for rMVP statistical methods. | ||
| # Naming convention: .<METHOD>_<DESCRIPTION> (dot-prefix keeps them non-exported) | ||
|
|
||
| # FaSTLMM log-likelihood optimization | ||
| .FASTLMM_SVD_THRESHOLD <- 1e-8 # singular value cutoff in SVD | ||
| .FASTLMM_DELTA_EXP_START <- -5 # log-delta grid lower bound | ||
| .FASTLMM_DELTA_EXP_END <- 5 # log-delta grid upper bound | ||
| .FASTLMM_DELTA_EXP_STEP <- 0.1 # log-delta grid step size | ||
| .FASTLMM_DELTA_EXP_DEGENERATE <- 100 # sentinel: collapse grid to single point when SNP pool has a constant column | ||
| .FASTLMM_2PI <- 2 * pi # NOTE: original code had 2 * 3.14 (bug); corrected to 2 * pi | ||
|
|
||
| # EMMA variance component estimation (defaults match original function signature) | ||
| .EMMA_NGRIDS <- 100 | ||
| .EMMA_LLIM <- -10 | ||
| .EMMA_ULIM <- 10 | ||
| .EMMA_ESP <- 1e-10 | ||
|
|
||
| # BRENT variance component estimation | ||
| .BRENT_MIN_EIGENVALUE <- 1e-6 # eigenvalue floor to avoid division by near-zero | ||
|
|
||
| # HE regression | ||
| .HE_DEFAULT_LOG_SIGMA2 <- log(0.1) # log-sigma2 fallback when CalcVChe returns non-positive value | ||
|
|
||
| # FarmCPU | ||
| .FARMCPU_LD_THRESHOLD <- 0.7 # LD threshold for pseudo-QTN deduplication | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These constants are defined here but
MVP.EMMA.Vg.Ve.rstill uses hardcoded defaults (ngrids=100,llim=-10,ulim=10,esp=1e-10). Is this intentional (deferred to a follow-up PR)? Just want to confirm.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not intentional — this was an oversight. Fixed in
14eed67.The function signature keeps literal defaults (
ngrids=100,llim=-10,ulim=10,esp=1e-10) because R CMD check'scodocrequires exported function formals to be evaluable as literals; using.EMMA_NGRIDSdirectly in the signature would break that. A comment at the top of the body now explicitly links each default to its canonical constant inMVP.Constants.R.Additionally, the two bare
2 * piliterals inside the inner REML log-likelihood helpers have been replaced with.FASTLMM_2PI, matching the same substitution already made inMVP.FaSTLMM.LL.r. Both methods share the same LL formula structure, so this makes them consistent.