Skip to content

Conversation

@Xaleed
Copy link
Collaborator

@Xaleed Xaleed commented Dec 8, 2025

The Fortran code is directly translated to Rcpp. To install, follow these steps:
Remove the existing package first
remove.packages("biplotEZ")

Install from the KMbranch branch
devtools::install_github("MuViSU/biplotEZ", ref = "KMbranch")

Load and test
library(biplotEZ)

You may notice that this Rcpp-based implementation is not as fast as the original Fortran version. This is primarily due to the line-by-line translation from Fortran, which does not fully exploit Rcpp’s strengths and therefore results in non-optimal performance. Addressing this issue would require certain modifications to the algorithm, for which I would need your permission. I would be happy to discuss the possible approaches in a meeting at your convenience.

There is an additional folder (\texttt{temp}), which is described below. The files in this directory are not cleaned:
I also add a temporary folder (examples/temp/) and example to test the replacement of the FORTRAN implementation with R’s function and a .Rcpp file.

  • The examples in examples/temp/ contains R code following the library’s main function logic (Fortran and Rcpp). Please run them on your system for any suggestions.

  • A new file in src/ (.Rcpp) has been added, which is called from the example.

  • The example is purely for testing purposes and does not affect the library, as examples/temp/ is included in .Rbuildignore.

Note: This is not intended for merging yet; the example can be removed when the branch is eventually merged.

@Xaleed Xaleed requested review from jnienk and sugnet and removed request for jnienk December 17, 2025 12:54
//Optimize alfunc by computing Z directly from BVEC and combining loops

//- Eliminated intermediate B matrix creation by computing Z = M %*% B directly from BVEC vector
//- Combined three separate loops (exind, prediction, loss calculation) into single pass
//- Removed fortran-unused utility functions matm() and exind()
//- Reduces memory allocations and improves cache locality
//- Maintains identical mathematical behavior with better performance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants